172112025-06-03 15:54:36ercseferencSzimmetrikus 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;
    //ifstream f("szamok.txt");
    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;
            for(int j=0; j<v; j++){
                csoportok[a[x].csop].push_back(csoportok[w][j]);
                a[csoportok[w][j]].ert=a[x].ert;
                a[csoportok[w][j]].csop=a[x].csop;
                csoportok[w]=ures;}}}
    /*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 answer56ms6644 KiB
subtask20/9
3Wrong answer2ms316 KiB
4Wrong answer2ms500 KiB
5Wrong answer2ms500 KiB
6Accepted2ms316 KiB
7Wrong answer1ms316 KiB
subtask30/14
8Wrong answer1ms316 KiB
9Wrong answer1ms316 KiB
10Wrong answer1ms508 KiB
11Wrong answer1ms556 KiB
12Wrong answer1ms316 KiB
13Wrong answer1ms316 KiB
subtask40/25
14Wrong answer1ms316 KiB
15Wrong answer1ms508 KiB
16Wrong answer2ms564 KiB
17Wrong answer2ms564 KiB
18Wrong answer2ms548 KiB
19Wrong answer2ms576 KiB
20Wrong answer2ms532 KiB
21Wrong answer2ms316 KiB
subtask50/22
22Wrong answer101ms8928 KiB
23Runtime error300ms131072 KiB
24Wrong answer105ms10976 KiB
25Wrong answer104ms9288 KiB
26Wrong answer103ms9100 KiB
27Runtime error291ms131072 KiB
28Wrong answer109ms12676 KiB
29Wrong answer104ms9184 KiB
30Wrong answer101ms9100 KiB
31Runtime error277ms131072 KiB
32Wrong answer107ms14308 KiB
33Wrong answer109ms8928 KiB
34Wrong answer94ms8928 KiB
35Runtime error289ms131072 KiB
36Wrong answer108ms15328 KiB
37Wrong answer103ms9176 KiB
subtask60/30
38Wrong answer1ms316 KiB
39Wrong answer57ms6628 KiB
40Wrong answer2ms316 KiB
41Wrong answer2ms500 KiB
42Wrong answer2ms500 KiB
43Accepted2ms316 KiB
44Wrong answer1ms316 KiB
45Wrong answer1ms316 KiB
46Wrong answer1ms316 KiB
47Wrong answer1ms508 KiB
48Wrong answer1ms556 KiB
49Wrong answer1ms316 KiB
50Wrong answer1ms316 KiB
51Wrong answer1ms316 KiB
52Wrong answer1ms508 KiB
53Wrong answer2ms564 KiB
54Wrong answer2ms564 KiB
55Wrong answer2ms548 KiB
56Wrong answer2ms576 KiB
57Wrong answer2ms532 KiB
58Wrong answer2ms316 KiB
59Wrong answer101ms8928 KiB
60Runtime error300ms131072 KiB
61Wrong answer105ms10976 KiB
62Wrong answer104ms9288 KiB
63Wrong answer103ms9100 KiB
64Runtime error291ms131072 KiB
65Wrong answer109ms12676 KiB
66Wrong answer104ms9184 KiB
67Wrong answer101ms9100 KiB
68Runtime error277ms131072 KiB
69Wrong answer107ms14308 KiB
70Wrong answer109ms8928 KiB
71Wrong answer94ms8928 KiB
72Runtime error289ms131072 KiB
73Wrong answer108ms15328 KiB
74Wrong answer103ms9176 KiB
75Wrong answer129ms12512 KiB
76Wrong answer112ms10216 KiB
77Wrong answer65ms4780 KiB
78Wrong answer111ms11496 KiB
79Wrong answer108ms10792 KiB
80Wrong answer96ms7912 KiB
81Wrong answer97ms7912 KiB
82Wrong answer96ms7832 KiB
83Wrong answer134ms12512 KiB
84Wrong answer71ms4780 KiB
85Wrong answer108ms11040 KiB
86Wrong answer103ms8160 KiB
87Wrong answer103ms8160 KiB
88Wrong answer101ms8160 KiB
89Accepted101ms8160 KiB