172092025-06-03 15:37:39ercseferencSzimmetrikus sorozatcpp17Wrong answer 0/100300ms131072 KiB
#include <bits/stdc++.h>
using namespace std;
struct par{int a,b;};
struct adatszam{int ert,ind,csop;};
bool has1(adatszam m, adatszam n){
    return m.ert<n.ert;}
bool has2(adatszam m, adatszam n){
    return m.ind<n.ind;}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0); vector<par>b;
    int n,x,y; cin>>n;
    vector<adatszam>a(n);
    for(int i=0; i<n; i++){cin>>a[i].ert; a[i].ind=i;}
    vector<vector<int> >csoportok; int t=0;
    sort(a.begin(),a.end(), has1);
    vector<int>ures; csoportok.push_back(ures);
   for(int i=0; i<n; i++){
        csoportok[t].push_back(a[i].ind);
        a[i].csop=t;
        if(a[i].ert!=a[i+1].ert && i!=n-1){t++;
        csoportok.push_back(ures);}}
    sort(a.begin(),a.end(), has2);
    for(int i=0; i<n/2; i++){
        if(a[i].ert!=a[n-i-1].ert){
            if(a[i].ert>a[n-i-1].ert){
                x=n-i-1, y=i;}
            else {x=i; y=n-i-1;}
            par q; q.a=a[y].ert; q.b=a[x].ert; b.push_back(q);
            int v=csoportok[a[y].csop].size();
            int w=a[y].csop;
            int v2=a[x].csop;
            int v3=a[x].ert;
            for(int j=0; j<v; j++){
                csoportok[v2].push_back(csoportok[w][j]);
                a[csoportok[w][j]].ert=v3;
                a[csoportok[w][j]].csop=v2;}}}
    /*cout<<b.size()<<endl;
    for(int i=0; i<b.size(); i++)cout<<b[i].a<<" "<<b[i].b<<endl;*/
    cout<<0;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer1ms316 KiB
2Wrong answer56ms6632 KiB
subtask20/9
3Wrong answer2ms316 KiB
4Wrong answer2ms316 KiB
5Wrong answer2ms316 KiB
6Accepted2ms316 KiB
7Wrong answer1ms316 KiB
subtask30/14
8Wrong answer1ms508 KiB
9Wrong answer1ms316 KiB
10Wrong answer1ms508 KiB
11Wrong answer1ms348 KiB
12Wrong answer1ms384 KiB
13Wrong answer1ms508 KiB
subtask40/25
14Wrong answer1ms316 KiB
15Wrong answer1ms316 KiB
16Wrong answer2ms564 KiB
17Wrong answer2ms564 KiB
18Wrong answer2ms564 KiB
19Wrong answer2ms564 KiB
20Wrong answer2ms460 KiB
21Wrong answer2ms316 KiB
subtask50/22
22Wrong answer100ms9096 KiB
23Runtime error300ms131072 KiB
24Wrong answer107ms10976 KiB
25Wrong answer104ms9104 KiB
26Wrong answer103ms8928 KiB
27Runtime error296ms131072 KiB
28Wrong answer107ms12764 KiB
29Wrong answer105ms8928 KiB
30Wrong answer103ms8928 KiB
31Runtime error266ms131072 KiB
32Wrong answer104ms14304 KiB
33Wrong answer109ms8928 KiB
34Wrong answer96ms8928 KiB
35Runtime error300ms131072 KiB
36Wrong answer103ms15328 KiB
37Wrong answer104ms8932 KiB
subtask60/30
38Wrong answer1ms316 KiB
39Wrong answer57ms6632 KiB
40Wrong answer2ms316 KiB
41Wrong answer2ms316 KiB
42Wrong answer2ms316 KiB
43Accepted2ms316 KiB
44Wrong answer1ms316 KiB
45Wrong answer1ms508 KiB
46Wrong answer1ms316 KiB
47Wrong answer1ms508 KiB
48Wrong answer1ms348 KiB
49Wrong answer1ms384 KiB
50Wrong answer1ms508 KiB
51Wrong answer1ms316 KiB
52Wrong answer1ms316 KiB
53Wrong answer2ms564 KiB
54Wrong answer2ms564 KiB
55Wrong answer2ms564 KiB
56Wrong answer2ms564 KiB
57Wrong answer2ms460 KiB
58Wrong answer2ms316 KiB
59Wrong answer100ms9096 KiB
60Runtime error300ms131072 KiB
61Wrong answer107ms10976 KiB
62Wrong answer104ms9104 KiB
63Wrong answer103ms8928 KiB
64Runtime error296ms131072 KiB
65Wrong answer107ms12764 KiB
66Wrong answer105ms8928 KiB
67Wrong answer103ms8928 KiB
68Runtime error266ms131072 KiB
69Wrong answer104ms14304 KiB
70Wrong answer109ms8928 KiB
71Wrong answer96ms8928 KiB
72Runtime error300ms131072 KiB
73Wrong answer103ms15328 KiB
74Wrong answer104ms8932 KiB
75Wrong answer145ms12512 KiB
76Wrong answer105ms10216 KiB
77Wrong answer65ms4780 KiB
78Wrong answer111ms11496 KiB
79Wrong answer108ms10792 KiB
80Wrong answer96ms7912 KiB
81Wrong answer96ms7908 KiB
82Wrong answer97ms7828 KiB
83Wrong answer133ms12512 KiB
84Wrong answer71ms4780 KiB
85Wrong answer108ms10788 KiB
86Wrong answer101ms8172 KiB
87Wrong answer103ms8156 KiB
88Wrong answer101ms8156 KiB
89Accepted101ms8020 KiB