172082025-06-03 15:34:51ercseferencSzimmetrikus sorozatcpp17Wrong answer 0/100323ms131072 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;
            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;*/}}}
    /*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 answer56ms5608 KiB
subtask20/9
3Wrong answer4ms2484 KiB
4Wrong answer1ms496 KiB
5Wrong answer1ms496 KiB
6Accepted1ms316 KiB
7Wrong answer1ms316 KiB
subtask30/14
8Wrong answer1ms316 KiB
9Wrong answer1ms316 KiB
10Wrong answer1ms316 KiB
11Wrong answer1ms316 KiB
12Wrong answer1ms316 KiB
13Wrong answer1ms316 KiB
subtask40/25
14Wrong answer1ms316 KiB
15Wrong answer1ms316 KiB
16Wrong answer2ms568 KiB
17Wrong answer3ms568 KiB
18Wrong answer2ms564 KiB
19Wrong answer2ms564 KiB
20Wrong answer3ms712 KiB
21Wrong answer2ms316 KiB
subtask50/22
22Wrong answer104ms10124 KiB
23Runtime error268ms131072 KiB
24Wrong answer104ms9864 KiB
25Wrong answer108ms10128 KiB
26Wrong answer108ms10204 KiB
27Runtime error282ms131072 KiB
28Wrong answer104ms9952 KiB
29Wrong answer105ms10124 KiB
30Wrong answer107ms10208 KiB
31Runtime error277ms131072 KiB
32Wrong answer100ms9860 KiB
33Wrong answer109ms10204 KiB
34Wrong answer98ms10208 KiB
35Wrong answer228ms79584 KiB
36Wrong answer100ms9952 KiB
37Wrong answer104ms10124 KiB
subtask60/30
38Wrong answer1ms500 KiB
39Wrong answer57ms5608 KiB
40Wrong answer4ms2484 KiB
41Wrong answer1ms496 KiB
42Wrong answer1ms496 KiB
43Accepted1ms316 KiB
44Wrong answer1ms316 KiB
45Wrong answer1ms316 KiB
46Wrong answer1ms316 KiB
47Wrong answer1ms316 KiB
48Wrong answer1ms316 KiB
49Wrong answer1ms316 KiB
50Wrong answer1ms316 KiB
51Wrong answer1ms316 KiB
52Wrong answer1ms316 KiB
53Wrong answer2ms568 KiB
54Wrong answer3ms568 KiB
55Wrong answer2ms564 KiB
56Wrong answer2ms564 KiB
57Wrong answer3ms712 KiB
58Wrong answer2ms316 KiB
59Wrong answer104ms10124 KiB
60Runtime error268ms131072 KiB
61Wrong answer104ms9864 KiB
62Wrong answer108ms10128 KiB
63Wrong answer108ms10204 KiB
64Runtime error282ms131072 KiB
65Wrong answer104ms9952 KiB
66Wrong answer105ms10124 KiB
67Wrong answer107ms10208 KiB
68Runtime error277ms131072 KiB
69Wrong answer100ms9860 KiB
70Wrong answer109ms10204 KiB
71Wrong answer98ms10208 KiB
72Wrong answer228ms79584 KiB
73Wrong answer100ms9952 KiB
74Wrong answer104ms10124 KiB
75Wrong answer138ms11916 KiB
76Wrong answer115ms14056 KiB
77Runtime error273ms131072 KiB
78Wrong answer148ms21904 KiB
79Runtime error303ms131072 KiB
80Wrong answer97ms7912 KiB
81Wrong answer100ms7912 KiB
82Wrong answer97ms7912 KiB
83Wrong answer135ms11996 KiB
84Runtime error323ms131072 KiB
85Runtime error277ms131072 KiB
86Wrong answer103ms8072 KiB
87Wrong answer105ms8352 KiB
88Wrong answer104ms8160 KiB
89Accepted104ms8160 KiB