QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#85363#5238. Fotografia [C]anhduc27011 22ms53664kbC++233.0kb2023-03-07 17:36:442023-03-07 17:36:47

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-07 17:36:47]
  • 评测
  • 测评结果:1
  • 用时:22ms
  • 内存:53664kb
  • [2023-03-07 17:36:44]
  • 提交

answer

/*
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define len(x) (int)(x.size())
#define eb emplace_back
#define PI 3.14159265359
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define MIN(v) *min_element(all(v))
#define MAX(v) *max_element(all(v))
#define BIT(x,i) (1&((x)>>(i)))
#define MASK(x) (1LL<<(x))
#define task "FOT"  
typedef long long ll;
const ll INF=1e18;
const int maxn=1e6+5;
const int mod=1e9+7;
const int mo=998244353;
using pi=pair<ll,ll>;
using vi=vector<ll>;
using pii=pair<pair<ll,ll>,ll>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n;
int a[maxn];
int ok[maxn];
vector<int>vt;
vector<int>q[maxn];
int st[maxn];
vector<pair<int,int>>ans[maxn];
int k=0;

void dequy(vector<int>q,int ti){
    
    if(len(q)<=1){
        return;
    }
    if(len(q)==2){
        k=max(k,1);
        ans[ti].pb({q[0],q[1]});
        return;
    }
    k=max(k,ti);
    if(len(q)%2==0){
        int sz=len(q);
        vector<int>d1;
        int so=sz-1;
        for(int i=1;i<=so;i++){
            ans[ti].pb({q[i],q[so]});
            swap(q[i],q[so]);
            so--;
            d1.pb(q[i]);
        }
        for(int i=0;i<q.size();i++){
            ans[ti+1].pb({q[i],q[i+1]});
        }
        k=2;
    }
    else{
        int sz=len(q);
        vector<int>d1;
        if(sz==3){

            ans[ti].pb({q[0],q[1]});
            ans[ti+1].pb({q[0],q[2]});
            k=2;
        }
        else{
            ans[ti].pb({q[0],q[1]});
            ans[ti].pb({q[2],q.back()});
            swap(q[0],q[1]);

            int so=sz-2;
            for(int i=3;i<so;i++){
                ans[ti].pb({q[i],q[so]});

                swap(q[i],q[so]);
                so--;
            }
            for(int i=1;i<q.size();i+=2){
                ans[ti+1].pb({q[i],q[i+1]});
            }
            k=2;
        } 
    }
}
signed main()
{
	cin.tie(0),cout.tie(0)->sync_with_stdio(0);
    // freopen(task".inp" , "r" , stdin);
    // freopen(task".out" , "w" , stdout);
    cin>>n;
    for(int i=1;i<=n;i++){
    	cin>>a[i];
    	vt.pb(a[i]);
    }
    sort(vt.begin(),vt.end());
    vt.resize(distance(vt.begin(),unique(vt.begin(),vt.end())));
    for(int i=1;i<=n;i++){
    	a[i]=lower_bound(vt.begin(),vt.end(),a[i])-vt.begin()+1;
        // cout<<a[i]<<" ";
    }
    int cycle=0;
    int d=0;
    for(int i=1;i<=n;i++){
    	if(ok[a[i]]==0){
    		int x=i;
    		cycle++;
    		while(ok[x]==0){
    			ok[x]=1;
    			q[cycle].pb(x);
    			x=a[x];
    		}
            dequy(q[cycle],1);
    	}
    }
    cout<<k<<"\n";
    for(int i=1;i<=k;i++){
    	deque<int>de;
    	for(auto v:ans[i]){
    		de.push_front(v.fi);
    		de.push_back(v.se);
    		
    	}
    	cout<<de.size()<<"\n";
    	for(auto v:de){
    		cout<<v<<" ";
    	}
    	cout<<'\n';
    }
    return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 1
Accepted

Test #1:

score: 1
Accepted
time: 12ms
memory: 50740kb

input:

5
138
352
915
1375
2848

output:

0

result:

ok correct plan!

Test #2:

score: 0
Accepted
time: 14ms
memory: 53536kb

input:

5
2182
1715
524
2331
2791

output:

1
2
1 3 

result:

ok correct plan!

Test #3:

score: 0
Accepted
time: 3ms
memory: 51212kb

input:

4
77
774
1089
2658

output:

0

result:

ok correct plan!

Test #4:

score: 0
Accepted
time: 9ms
memory: 52068kb

input:

3
517
1232
2233

output:

0

result:

ok correct plan!

Test #5:

score: 0
Accepted
time: 14ms
memory: 50380kb

input:

2
2174
2569

output:

0

result:

ok correct plan!

Test #6:

score: 0
Accepted
time: 4ms
memory: 50416kb

input:

2
1790
2393

output:

0

result:

ok correct plan!

Test #7:

score: 0
Accepted
time: 8ms
memory: 50352kb

input:

5
1111
1996
228
2700
1740

output:

2
4
4 1 2 3 
4
5 1 4 3 

result:

ok correct plan!

Test #8:

score: 0
Accepted
time: 11ms
memory: 50288kb

input:

3
378
274
1644

output:

1
2
1 2 

result:

ok correct plan!

Test #9:

score: 0
Accepted
time: 11ms
memory: 50404kb

input:

5
2108
2822
2877
55
743

output:

2
4
5 1 3 4 
4
2 1 5 4 

result:

ok correct plan!

Test #10:

score: 0
Accepted
time: 11ms
memory: 52004kb

input:

2
1998
2103

output:

0

result:

ok correct plan!

Test #11:

score: 0
Accepted
time: 7ms
memory: 50424kb

input:

5
2415
697
1067
813
2616

output:

2
2
1 4 
2
1 2 

result:

ok correct plan!

Test #12:

score: 0
Accepted
time: 4ms
memory: 50284kb

input:

5
1979
605
1578
2181
2305

output:

2
2
1 3 
2
1 2 

result:

ok correct plan!

Test #13:

score: 0
Accepted
time: 8ms
memory: 52288kb

input:

5
2918
2570
2733
959
356

output:

2
4
2 1 5 3 
2
2 4 

result:

ok correct plan!

Test #14:

score: 0
Accepted
time: 15ms
memory: 50380kb

input:

2
2906
395

output:

1
2
1 2 

result:

ok correct plan!

Test #15:

score: 0
Accepted
time: 8ms
memory: 50328kb

input:

2
283
1574

output:

0

result:

ok correct plan!

Test #16:

score: 0
Accepted
time: 8ms
memory: 50704kb

input:

3
1530
462
2203

output:

1
2
1 2 

result:

ok correct plan!

Test #17:

score: 0
Accepted
time: 16ms
memory: 50404kb

input:

5
1266
1707
1664
555
478

output:

2
4
4 1 3 5 
4
2 1 4 5 

result:

ok correct plan!

Subtask #2:

score: 0
Wrong Answer

Test #18:

score: 1
Accepted
time: 9ms
memory: 50344kb

input:

10
321
457
797
885
892
1367
2480
2742
2767
2955

output:

0

result:

ok correct plan!

Test #19:

score: 0
Accepted
time: 12ms
memory: 51328kb

input:

10
1237
39
2762
2728
2645
2669
1833
1836
1572
1560

output:

1
10
6 5 4 3 1 2 10 9 7 8 

result:

ok correct plan!

Test #20:

score: 0
Accepted
time: 7ms
memory: 50352kb

input:

5
1274
1245
959
1921
2047

output:

1
2
1 3 

result:

ok correct plan!

Test #21:

score: 0
Accepted
time: 11ms
memory: 50340kb

input:

8
706
742
2453
1051
1813
1996
924
2834

output:

1
2
3 7 

result:

ok correct plan!

Test #22:

score: 0
Accepted
time: 12ms
memory: 51512kb

input:

7
1829
1214
637
1509
263
2824
2661

output:

1
6
6 2 1 5 3 7 

result:

ok correct plan!

Test #23:

score: 0
Accepted
time: 17ms
memory: 50456kb

input:

4
2812
1607
216
2984

output:

1
2
1 3 

result:

ok correct plan!

Test #24:

score: -1
Wrong Answer
time: 8ms
memory: 50280kb

input:

10
667
1242
121
2290
382
197
616
2857
2685
1637

output:

2
8
10 8 2 1 5 6 7 10 
10
8 10 7 4 1 3 7 10 8 0 

result:

wrong answer invalid operation #1: duplicated elements

Subtask #3:

score: 0
Wrong Answer

Test #35:

score: 1
Accepted
time: 8ms
memory: 53468kb

input:

20
29
2902
1870
1908
711
1878
2034
1658
1690
533
1080
689
2282
2637
1599
1912
2365
2015
2659
275

output:

1
14
14 13 7 6 4 3 2 20 10 12 11 15 16 18 

result:

ok correct plan!

Test #36:

score: 0
Accepted
time: 8ms
memory: 52088kb

input:

17
2814
163
182
457
2403
1817
981
1639
922
779
1216
1497
1545
875
679
459
143

output:

1
10
8 7 6 5 1 17 16 15 10 14 

result:

ok correct plan!

Test #37:

score: 0
Accepted
time: 12ms
memory: 51992kb

input:

16
18
1723
2335
1290
1674
1341
523
1094
2529
2185
572
273
1642
287
1398
2584

output:

1
14
10 9 6 5 4 3 2 12 14 7 11 8 15 13 

result:

ok correct plan!

Test #38:

score: 0
Accepted
time: 4ms
memory: 50420kb

input:

7
872
1040
468
220
370
2490
2599

output:

1
4
2 1 4 5 

result:

ok correct plan!

Test #39:

score: 0
Accepted
time: 8ms
memory: 50336kb

input:

12
2576
1207
2984
1769
1888
2139
2002
2314
2281
2382
157
1729

output:

1
8
8 6 3 1 11 12 7 9 

result:

ok correct plan!

Test #40:

score: -1
Wrong Answer
time: 11ms
memory: 50400kb

input:

20
452
2228
1112
264
812
56
2827
2442
1285
1432
2007
1874
2837
2684
1918
2812
61
1585
2839
2167

output:

2
16
13 11 8 7 16 14 3 4 6 3 17 16 18 15 10 19 
24
13 12 8 7 14 16 17 2 4 3 6 1 6 3 4 0 17 16 14 0 9 11 10 20 

result:

wrong answer invalid operation #1: duplicated elements

Subtask #4:

score: 0
Wrong Answer

Test #51:

score: 1
Accepted
time: 16ms
memory: 50648kb

input:

100
2985
38
1126
111
1953
886
2186
417
776
326
2961
388
240
1592
1203
1768
581
514
494
2762
1954
641
1731
685
723
1718
1143
761
318
2532
1193
1596
194
2014
2703
2515
2107
1049
2504
1088
1327
102
744
1162
1177
830
2579
461
1362
1100
1273
2471
2077
2628
1541
426
839
1643
1708
732
652
2665
1765
483
191...

output:

1
72
97 80 78 75 62 54 53 52 49 47 41 39 37 36 35 34 32 31 30 27 26 23 21 20 17 16 15 14 11 9 8 7 6 5 3 1 99 42 66 33 74 13 29 98 56 48 64 19 93 67 61 60 43 84 46 57 68 92 83 73 82 50 85 51 79 71 89 90 76 95 81 100 

result:

ok correct plan!

Test #52:

score: 0
Accepted
time: 19ms
memory: 50376kb

input:

55
953
121
130
1548
1252
2293
2389
1344
2533
2668
654
715
1012
868
887
1509
939
16
994
757
1150
1269
2216
351
1153
1832
2427
2573
549
1353
1365
1391
909
269
1612
1665
1284
2417
1942
1945
2151
1181
391
461
2391
1889
1304
646
1342
2598
2601
2803
649
2723
2607

output:

1
34
52 38 28 27 26 23 22 16 13 10 9 8 7 6 5 4 1 18 34 24 43 44 29 48 53 20 33 25 42 37 47 49 46 55 

result:

ok correct plan!

Test #53:

score: 0
Accepted
time: 8ms
memory: 50388kb

input:

63
157
2767
1602
272
366
821
644
1630
1912
417
1668
2114
416
893
914
2772
962
1673
1050
1089
2123
2851
1152
1250
2752
1418
1927
1510
1555
2715
215
443
719
984
1957
2364
2242
1904
1885
569
1497
1693
2609
722
1119
1862
2859
1844
2406
2526
2035
2622
2714
1597
2751
1284
177
946
2836
1129
2322
2908
2947

output:

1
42
47 43 38 37 36 35 30 27 25 22 21 18 16 12 11 9 8 7 6 3 2 57 31 13 10 32 40 33 44 58 34 45 60 56 41 54 42 48 46 39 51 61 

result:

ok correct plan!

Test #54:

score: 0
Accepted
time: 20ms
memory: 51560kb

input:

65
1212
2294
45
152
2234
500
1765
1025
437
234
1394
755
632
688
748
596
2592
1092
892
901
1403
982
987
1004
2637
403
2037
834
1116
1125
1626
16
591
976
1512
1140
2000
2053
1709
2565
388
1868
2303
1960
1631
2024
1090
1697
2842
2945
174
33
1922
1752
766
2596
1020
2808
2647
2839
2087
2874
2889
2200
2996

output:

1
42
58 50 49 43 40 38 37 31 27 25 21 18 17 12 11 8 7 6 5 2 1 32 52 51 10 41 26 33 16 55 28 34 57 47 36 45 48 54 53 61 64 59 

result:

ok correct plan!

Test #55:

score: 0
Accepted
time: 3ms
memory: 51584kb

input:

46
181
313
2481
276
1408
983
862
560
2920
814
448
1713
2828
2469
389
2459
2246
359
1957
1446
1912
1558
881
1727
1557
1426
2272
2081
1288
2029
2579
2390
2403
2581
993
921
2472
302
2501
2312
2446
2726
909
2865
639
2997

output:

1
32
34 31 27 21 19 17 16 14 13 12 9 7 6 5 3 2 4 38 18 15 11 45 23 43 36 35 29 26 25 30 40 41 

result:

ok correct plan!

Test #56:

score: -1
Wrong Answer
time: 8ms
memory: 51596kb

input:

100
2399
1088
94
2815
1295
2746
2576
1061
2689
2468
137
2198
1222
886
2449
531
2923
1190
631
2131
1157
924
2622
2596
58
647
767
1196
1726
2137
2246
479
653
931
1433
1873
129
738
689
239
752
2024
607
2685
2585
1923
675
242
983
1341
300
2853
1446
1980
2992
1948
2571
627
2377
368
1761
532
2245
2906
206...

output:

2
84
66 97 96 56 55 52 65 67 75 36 35 30 63 54 57 24 74 87 22 21 69 20 18 17 28 15 73 31 13 12 53 79 9 90 7 6 8 48 93 4 2 1 76 38 99 93 37 8 91 83 40 89 51 53 71 60 32 73 78 88 98 43 58 69 41 33 47 74 85 39 72 63 70 50 59 84 68 65 94 100 61 86 97 80 
108
66 96 97 86 64 55 67 65 68 42 45 36 35 30 54 ...

result:

wrong answer invalid operation #1: duplicated elements

Subtask #5:

score: 0
Wrong Answer

Test #67:

score: 1
Accepted
time: 3ms
memory: 50428kb

input:

1000
2271
250
4
10
11
13
404
15
1911
2785
308
32
975
2111
1010
2335
2200
1626
45
46
2125
52
53
59
63
2138
2101
837
71
2503
2508
2659
79
542
90
92
299
602
106
2181
159
2167
2550
482
2702
1390
1487
2903
125
1687
129
466
143
279
1319
748
132
148
1141
111
336
164
175
2267
633
186
483
548
946
196
1085
20...

output:

1
678
960 940 937 918 903 890 886 869 855 846 843 839 837 836 830 827 808 806 797 792 786 785 781 779 762 748 744 731 720 719 714 705 698 688 687 685 682 679 678 673 672 666 665 655 651 650 647 646 641 636 633 632 626 624 623 618 616 614 613 607 597 596 595 590 588 583 580 577 573 560 559 554 548 54...

result:

ok correct plan!

Test #68:

score: 0
Accepted
time: 15ms
memory: 50352kb

input:

381
4
32
1296
15
1120
232
1706
1413
46
2560
2265
54
58
67
1877
2918
84
1561
282
2005
2596
2573
152
2623
1399
281
187
194
2794
226
39
2399
1460
1246
178
114
292
2783
367
2940
319
320
593
2406
769
2109
350
300
370
1880
2341
377
2551
385
431
393
505
2416
2902
614
391
821
897
2444
2345
1617
2432
1552
29...

output:

1
252
369 349 348 341 329 327 299 297 296 294 291 284 282 269 265 254 249 229 227 224 218 213 211 208 207 206 205 201 199 197 191 189 185 184 182 179 176 171 170 169 168 165 162 161 160 159 156 154 153 149 146 141 140 139 136 135 134 130 128 126 124 123 117 115 113 110 109 98 96 94 92 90 89 87 83 80...

result:

ok correct plan!

Test #69:

score: 0
Accepted
time: 3ms
memory: 50416kb

input:

633
80
1590
412
1592
2437
17
257
20
2163
2063
24
987
2144
2296
42
886
413
2440
1085
1646
229
69
70
703
75
2
81
2545
1781
112
116
1615
2136
1737
1411
156
159
1660
170
174
2145
843
191
2971
259
197
1395
463
2001
2576
571
1218
2990
1822
410
220
2045
224
228
67
2318
239
2316
1641
2810
19
195
263
2724
38...

output:

1
420
553 530 516 512 510 507 496 479 471 461 455 445 443 440 438 436 417 416 414 413 411 410 396 395 389 379 372 369 367 364 362 361 356 355 350 346 344 343 336 334 328 327 325 322 314 312 311 308 307 305 302 297 295 290 288 286 285 284 283 282 280 278 273 272 271 270 269 268 267 259 258 252 251 25...

result:

ok correct plan!

Test #70:

score: 0
Accepted
time: 18ms
memory: 50420kb

input:

56
6
44
850
105
591
372
1539
440
2773
460
692
241
1438
513
749
2844
103
1052
2083
2085
1269
1100
1140
1167
2659
1080
1298
2258
2138
1436
639
407
1574
1729
1879
1934
2836
1967
2378
1074
1077
1433
1300
2262
2289
2056
2511
2569
1216
449
2835
1965
786
2848
2868
2976

output:

1
30
39 37 29 28 25 21 20 19 16 13 11 9 7 5 3 17 12 32 50 14 31 53 40 41 26 49 43 42 52 46 

result:

ok correct plan!

Test #71:

score: 0
Accepted
time: 14ms
memory: 50464kb

input:

842
14
719
1818
9
1782
6
1186
903
25
1787
29
33
1627
38
40
1842
1085
2192
64
56
1625
2956
60
63
55
2446
2353
1700
69
1962
973
78
2224
1328
2456
89
1745
2759
102
110
113
117
119
2834
2317
126
128
132
1810
1100
1477
141
2335
2678
2763
1798
1550
167
176
177
410
185
356
561
198
204
981
855
2389
220
2483...

output:

1
538
773 770 737 736 725 714 706 702 696 686 685 682 675 671 653 646 645 642 638 637 631 628 623 609 608 607 600 599 594 593 588 582 580 570 559 557 551 550 549 546 543 539 534 533 531 527 525 520 518 512 503 501 498 497 489 487 486 481 480 479 475 472 470 469 464 463 461 458 454 442 437 433 431 42...

result:

ok correct plan!

Test #72:

score: -1
Wrong Answer
time: 11ms
memory: 50896kb

input:

1000
369
505
2388
1625
20
1023
94
2624
2181
2606
572
132
66
2061
1060
2275
1346
2743
1357
2678
2147
1289
2837
1728
1411
1371
2660
231
963
1784
1566
1301
1013
641
1793
453
2049
2974
121
633
1491
2690
620
2111
1364
2252
2373
1806
1320
26
1036
2263
2754
927
27
2703
784
2303
644
2646
1751
1142
715
1905
...

output:

2
998
216 584 86 248 159 437 89 352 142 36 493 911 382 825 854 765 585 136 515 516 188 191 725 720 715 77 433 296 707 511 788 464 744 423 645 571 730 144 700 897 20 66 418 819 960 918 997 671 37 702 424 524 806 829 985 653 576 910 415 22 13 55 714 945 168 767 573 811 189 202 595 539 851 555 572 644 ...

result:

wrong answer the array is not sorted

Subtask #6:

score: 0
Wrong Answer

Test #78:

score: 1
Accepted
time: 3ms
memory: 50464kb

input:

3000
1
2
3
2029
1711
669
2046
1892
2438
2863
279
12
2604
478
1122
2318
17
497
1969
775
21
2173
865
24
2682
1567
27
551
29
2699
600
32
33
2996
2960
1779
37
38
214
2590
1241
2518
43
1781
2824
390
1384
524
432
50
51
2975
53
406
55
56
57
2188
1410
2578
1447
1060
63
2081
580
2755
67
2560
2722
1071
71
72
...

output:

1
2016
2907 2903 2873 2862 2852 2846 2814 2793 2781 2758 2752 2737 2732 2710 2695 2693 2679 2665 2663 2638 2625 2607 2588 2580 2577 2562 2554 2551 2548 2545 2505 2503 2472 2446 2445 2429 2421 2393 2391 2380 2379 2372 2363 2357 2352 2341 2330 2324 2312 2306 2304 2294 2284 2276 2270 2268 2266 2262 223...

result:

ok correct plan!

Test #79:

score: 0
Accepted
time: 4ms
memory: 50536kb

input:

2996
1
2
1519
4
426
6
7
2441
2877
10
11
2615
13
248
15
16
1583
2045
2262
20
2224
22
704
24
25
26
1365
354
34
2057
31
32
1968
29
2502
198
831
2328
485
2236
1608
1169
1513
2034
1740
1867
1030
2695
1715
50
2495
1178
449
719
55
742
1199
58
902
2875
1098
62
1634
291
1639
2604
1629
1157
69
70
1367
72
1441...

output:

1
1994
2876 2863 2858 2780 2767 2749 2721 2718 2706 2689 2681 2669 2638 2626 2624 2621 2601 2594 2587 2565 2561 2551 2541 2536 2525 2511 2509 2506 2504 2485 2473 2460 2448 2447 2439 2429 2411 2410 2407 2405 2401 2376 2373 2367 2363 2349 2347 2340 2333 2326 2316 2299 2278 2276 2269 2250 2249 2247 224...

result:

ok correct plan!

Test #80:

score: 0
Accepted
time: 11ms
memory: 50512kb

input:

2053
2296
1069
4
1981
2409
13
1573
481
1840
2559
20
1269
1917
1603
1030
28
29
162
1765
32
2243
927
39
41
42
43
82
1704
2988
2620
1958
1492
2206
57
1035
60
2138
2519
65
817
1798
69
1076
72
1325
1168
202
1893
2062
1198
1199
45
83
524
85
103
1396
89
91
1078
1263
96
100
839
1982
86
2615
1651
207
1750
11...

output:

1
1368
1989 1943 1883 1875 1871 1870 1866 1856 1820 1815 1806 1790 1759 1741 1724 1721 1711 1710 1700 1681 1679 1671 1658 1653 1651 1643 1630 1623 1610 1606 1601 1596 1590 1588 1583 1579 1573 1565 1551 1545 1522 1515 1504 1499 1497 1484 1478 1477 1472 1471 1470 1467 1466 1462 1458 1445 1442 1436 143...

result:

ok correct plan!

Test #81:

score: 0
Accepted
time: 8ms
memory: 50424kb

input:

1707
1707
10
1838
1145
1269
16
2917
2098
2813
2506
298
177
1236
396
27
30
1460
34
38
929
725
1338
2765
2987
51
2832
55
102
1303
1911
1525
678
1606
2905
71
625
450
74
76
758
1413
1866
81
2071
2078
1887
88
2324
2445
2622
1624
2008
1817
99
56
103
2272
105
106
2252
2440
1596
647
121
863
2926
2655
129
13...

output:

1
1080
1666 1628 1625 1577 1548 1542 1541 1504 1487 1476 1468 1461 1456 1455 1454 1425 1424 1403 1388 1377 1375 1370 1363 1354 1353 1350 1349 1344 1337 1334 1333 1329 1321 1290 1287 1279 1275 1271 1256 1249 1247 1245 1235 1231 1230 1229 1226 1220 1217 1214 1211 1208 1207 1206 1203 1197 1193 1192 119...

result:

ok correct plan!

Test #82:

score: 0
Accepted
time: 4ms
memory: 50456kb

input:

676
2146
1846
17
18
796
2192
27
35
62
2030
867
2916
804
58
42
2763
68
344
339
73
81
2707
858
1521
1772
89
1847
1464
1309
174
1004
282
116
122
287
1603
135
638
148
1170
167
169
1575
103
1256
178
2379
181
2034
2249
2345
390
207
209
211
556
1340
363
2177
755
242
367
245
250
1337
935
257
1421
262
115
13...

output:

1
428
648 621 599 591 570 565 552 518 517 509 502 499 494 478 474 465 464 459 458 451 449 442 440 438 437 436 434 431 430 428 418 412 404 401 396 395 393 391 389 388 385 380 378 369 368 367 365 355 352 349 348 346 345 344 342 338 337 331 329 327 317 316 313 304 303 300 299 296 291 285 284 283 282 27...

result:

ok correct plan!

Test #83:

score: -1
Wrong Answer
time: 15ms
memory: 50504kb

input:

3000
1193
621
2709
2314
152
1799
45
2270
1655
2982
2367
724
1336
758
2860
2074
2614
1672
2626
638
871
22
759
1534
679
383
2277
2753
2031
2961
518
2493
2299
620
830
41
2403
824
49
2211
1314
1605
83
1759
2308
1363
1926
1784
2809
2814
1943
1206
181
130
1958
2610
415
1603
2234
1491
1923
651
2044
1485
80...

output:

2
2398
2803 2812 2908 2457 2590 2921 2427 2410 2405 2397 2392 2384 2269 2235 2221 2209 2184 2183 2163 2161 2122 2425 2111 2102 2083 2064 2060 2009 1980 1963 1948 2106 1964 1935 1929 1893 1891 1867 1824 1816 1813 1794 1792 1767 1763 1761 2789 2261 1751 2970 1749 1743 2757 2985 2995 2737 1724 1717 171...

result:

wrong answer invalid operation #1: duplicated elements

Subtask #7:

score: 0
Wrong Answer

Test #94:

score: 0
Wrong Answer
time: 8ms
memory: 50888kb

input:

3000
729
1498
1848
569
1429
1721
2356
2504
483
158
2104
2471
2942
994
2046
2784
1613
1648
2834
1108
1805
1328
1984
1853
1180
2517
109
2601
2144
30
53
2173
1992
944
121
1595
1943
755
2732
2833
233
2934
1147
1091
2478
1948
252
962
221
400
1235
1486
31
69
1318
804
70
851
1026
930
2731
1922
713
1282
292...

output:

2
2430
2843 2821 2753 2712 2711 2666 2663 2631 2590 2531 2491 2454 2405 2398 2383 2382 2380 2375 2363 2323 2314 2271 2263 2212 2211 2190 2182 2160 2152 2106 2105 2090 2075 2072 2053 2042 2026 2024 2021 2019 1994 1993 1965 1960 1940 1931 1919 1896 1976 1892 1890 1882 2163 1881 2139 2706 2495 2384 186...

result:

wrong answer invalid operation #1: duplicated elements

Subtask #8:

score: 0
Wrong Answer

Test #105:

score: 0
Wrong Answer
time: 7ms
memory: 50468kb

input:

3000
766
1622
2731
1980
5
6
200
671
2792
1172
2005
1950
2806
557
2069
2552
1768
2600
2312
346
21
2376
2267
691
2995
26
2319
28
2148
30
970
2779
2645
1580
2627
1900
149
226
1642
1383
928
2575
1648
1859
2203
2701
1100
1391
1745
293
1625
670
1189
54
1413
1733
2878
2501
1765
841
61
454
2372
2901
1420
25...

output:

2
2390
2935 2642 2558 2514 2493 2446 2389 2314 2280 2351 2384 2241 2231 2230 2711 2679 2225 2218 2197 2192 2170 2169 2162 2861 2610 2056 2040 2038 2382 2146 1997 1991 1987 1983 1971 1970 1955 1925 1917 1889 1880 2710 2201 1870 1828 1820 2640 1813 1807 1800 1865 1794 2766 1789 1781 1762 1761 2649 210...

result:

wrong answer invalid operation #1: duplicated elements

Subtask #9:

score: 0
Wrong Answer

Test #116:

score: 1
Accepted
time: 8ms
memory: 50420kb

input:

3000
361
2
3
1184
5
6
7
8
2192
866
1680
935
13
14
618
16
140
18
1462
20
21
600
23
24
749
26
27
28
29
1947
54
2298
33
1313
303
2036
742
723
39
40
41
42
1381
2372
1112
46
2748
2536
49
50
51
52
53
31
1080
2481
57
82
59
2238
1647
62
2271
64
65
2773
67
167
2308
2022
252
794
73
74
2020
916
1141
1461
2287
...

output:

1
1944
2970 2851 2846 2787 2758 2738 2728 2695 2681 2669 2642 2636 2633 2595 2568 2552 2551 2549 2545 2543 2533 2530 2524 2521 2515 2514 2502 2499 2485 2461 2459 2453 2452 2445 2433 2432 2428 2426 2422 2418 2417 2414 2409 2398 2397 2393 2388 2381 2378 2376 2375 2341 2338 2326 2320 2318 2316 2313 230...

result:

ok correct plan!

Test #117:

score: 0
Accepted
time: 7ms
memory: 53664kb

input:

2354
508
2599
448
124
862
1613
2247
2475
12
2234
1454
1241
1979
1093
21
23
24
2734
556
2321
28
29
728
31
32
2624
34
37
38
39
2933
2286
42
2342
2501
1133
47
48
1282
894
2629
52
53
2082
441
61
1279
1375
64
65
66
67
68
69
548
401
2895
464
484
372
1513
2908
79
467
477
2164
84
1037
977
736
90
91
92
93
94...

output:

1
1610
2296 2286 2270 2177 2171 2153 2147 2141 2104 2094 2093 2065 2063 2056 2053 2051 2042 2037 2033 2022 2001 2000 1989 1987 1980 1978 1969 1959 1949 1930 1925 1922 1919 1916 1906 1905 1904 1890 1886 1882 1878 1865 1859 1858 1854 1853 1836 1831 1824 1823 1821 1815 1810 1803 1799 1789 1781 1769 176...

result:

ok correct plan!

Test #118:

score: 0
Accepted
time: 4ms
memory: 50548kb

input:

1055
2486
5
606
2601
12
16
17
21
1378
2911
1216
29
2793
2297
985
997
2435
1886
398
974
2434
64
66
67
2829
2265
2520
76
79
2374
82
2127
448
1483
1892
445
2842
2465
692
1792
110
2326
536
116
117
119
121
1454
1983
125
1591
1005
132
1666
139
147
1967
2626
1866
2801
880
156
157
694
356
547
1589
2949
2389...

output:

1
728
995 978 955 903 902 898 897 890 885 880 878 857 856 852 848 845 844 841 832 807 801 799 796 791 789 784 781 778 764 763 751 747 743 737 735 733 731 730 727 726 725 724 713 710 706 695 694 689 688 687 682 674 673 670 662 660 652 650 639 629 628 622 621 619 614 612 605 603 602 589 582 580 579 57...

result:

ok correct plan!

Test #119:

score: 0
Accepted
time: 8ms
memory: 52468kb

input:

1370
2189
944
1215
1154
12
417
1467
2693
17
19
1834
2616
2185
1240
1696
499
2097
764
1046
1014
35
1654
2404
41
2802
2790
45
48
2316
1886
51
145
2986
61
2900
66
2732
536
275
850
74
1741
2258
2039
2756
85
2051
89
1850
551
2636
97
98
99
101
105
2638
107
2564
109
271
1019
521
1217
126
1737
1860
130
2586...

output:

1
952
1309 1297 1286 1250 1233 1200 1192 1179 1166 1164 1157 1154 1140 1139 1138 1124 1122 1117 1116 1081 1063 1061 1058 1046 1027 1022 1021 1012 1010 1005 997 992 989 982 977 974 973 966 955 950 949 942 941 940 939 936 935 931 927 912 906 901 896 895 888 885 881 880 870 866 862 861 857 855 854 852 ...

result:

ok correct plan!

Test #120:

score: 0
Accepted
time: 3ms
memory: 50388kb

input:

910
1384
1888
1225
290
23
1729
1079
2691
1122
39
1251
2702
50
2243
2527
1274
1535
69
2627
648
1304
82
83
86
94
97
2661
105
111
112
578
2884
2919
313
2001
269
1219
135
2444
1063
734
1104
171
1142
1068
1387
183
847
701
2956
1373
1422
855
2962
202
1757
210
211
918
678
1819
225
2251
2692
707
1248
901
84...

output:

1
592
835 833 831 813 795 778 774 763 756 750 745 743 730 713 699 698 693 686 684 681 664 661 658 657 643 642 638 634 624 619 616 608 603 601 600 596 594 590 587 584 582 579 578 574 572 569 566 555 552 548 543 541 532 528 527 526 524 522 517 515 510 505 500 498 497 490 489 488 487 483 481 476 475 47...

result:

ok correct plan!

Test #121:

score: -1
Wrong Answer
time: 19ms
memory: 50456kb

input:

3000
2844
461
820
23
103
2381
115
2017
2666
2303
405
2169
1670
1335
842
1207
2988
1645
92
2142
402
1191
225
2960
2249
729
1242
607
738
2858
2596
488
985
1723
2183
2624
2081
1833
1966
1197
2240
508
1778
725
408
1304
440
471
552
1819
1040
670
2638
182
530
1801
410
799
652
1575
1356
1095
1205
1420
1135...

output:

2
2406
2914 2845 2843 2795 2759 2740 2696 2538 2512 2417 2383 2317 2316 2309 2241 2232 2187 2182 2177 2163 2155 2148 2145 2112 2109 2108 2104 2063 2052 2008 2001 1946 2311 2164 1941 1939 1919 1894 1891 1878 1869 2033 2095 1857 1851 1845 1831 1811 2479 1808 1800 1787 1836 1774 1767 1763 2631 2295 175...

result:

wrong answer invalid operation #1: duplicated elements

Subtask #10:

score: 0
Wrong Answer

Test #132:

score: 1
Accepted
time: 18ms
memory: 52424kb

input:

3000
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101...

output:

0

result:

ok correct plan!

Test #133:

score: 0
Accepted
time: 17ms
memory: 50432kb

input:

3000
1
2977
74
1664
2956
968
7
612
1394
839
147
1582
1970
506
15
16
17
18
444
1032
21
1634
1941
676
2222
1028
2266
1986
1565
30
2798
32
33
573
35
36
388
240
39
917
1047
2755
2894
44
45
257
1953
1436
49
50
51
52
1982
54
2766
1075
57
58
59
982
2441
1339
63
777
1298
816
2845
2098
69
70
2105
1868
73
3
1...

output:

1
1938
2875 2864 2853 2847 2841 2818 2800 2774 2771 2763 2758 2757 2722 2719 2713 2691 2652 2640 2617 2601 2592 2582 2579 2576 2568 2567 2552 2551 2538 2535 2522 2513 2509 2508 2496 2474 2473 2472 2468 2462 2459 2457 2450 2449 2439 2426 2425 2424 2421 2410 2404 2403 2399 2395 2394 2380 2369 2366 233...

result:

ok correct plan!

Test #134:

score: 0
Accepted
time: 4ms
memory: 52520kb

input:

1120
958
204
1391
2548
824
319
325
488
34
175
1658
43
2386
46
1218
547
1695
52
868
2643
1484
1230
2179
318
1984
1319
548
1308
83
1645
2710
798
92
556
2536
101
1405
105
413
108
2766
110
191
1211
113
723
559
1978
985
129
130
924
2934
1532
1537
138
804
1242
2935
153
149
1003
1223
2001
159
1814
2852
441...

output:

1
752
1105 1064 1036 1024 1020 998 993 978 975 970 949 947 932 920 914 913 899 895 882 879 866 863 859 852 851 841 833 825 814 811 806 803 796 788 781 776 760 753 748 743 740 739 737 732 731 730 725 718 717 714 712 703 700 695 692 684 679 674 671 668 664 663 661 659 651 649 645 643 637 634 633 619 6...

result:

ok correct plan!

Test #135:

score: 0
Accepted
time: 13ms
memory: 50776kb

input:

1037
312
2
8
606
12
2077
2546
916
758
559
924
37
39
1792
42
1173
47
2509
1183
1770
55
2856
1342
62
1401
75
713
78
2998
83
89
90
2957
1046
2143
110
2407
1963
213
469
1735
130
131
132
1199
291
783
142
321
2767
921
804
1333
156
2237
2753
161
1038
2244
2832
980
176
186
192
2428
196
199
205
1619
1583
126...

output:

1
678
989 963 960 958 956 915 906 891 881 879 876 873 872 867 860 858 830 813 809 803 801 794 778 774 767 766 764 755 752 748 747 744 740 735 728 725 717 716 715 712 709 694 692 691 688 685 679 677 673 670 668 666 664 658 649 643 639 636 633 632 629 625 624 623 622 620 616 615 613 601 594 591 589 58...

result:

ok correct plan!

Test #136:

score: 0
Accepted
time: 11ms
memory: 50420kb

input:

675
2763
331
869
2553
2002
1937
2258
739
789
956
2662
2626
35
53
2622
58
59
1502
2637
865
2876
1271
87
92
102
110
1297
710
2303
1462
1816
2716
2850
144
2935
149
168
1842
755
353
173
685
1977
185
915
266
293
201
1545
692
2442
1708
568
2774
766
230
237
2521
252
1067
255
262
1998
188
1031
2697
785
272
...

output:

1
458
673 658 650 595 588 552 549 548 535 529 524 513 497 494 492 489 487 486 484 483 476 468 467 464 463 451 449 446 444 443 434 432 431 427 424 420 414 413 412 404 401 400 393 390 381 378 371 369 368 365 363 361 352 350 347 346 344 342 339 337 336 334 333 331 330 320 319 318 316 310 308 305 296 29...

result:

ok correct plan!

Test #137:

score: 0
Accepted
time: 9ms
memory: 51528kb

input:

26
831
445
1431
2543
696
753
2719
818
377
849
1113
1456
1248
2259
671
1204
2233
1966
2577
2364
1804
1279
2084
675
2039
795

output:

1
18
20 19 17 14 12 7 4 3 1 9 15 24 26 16 22 21 25 23 

result:

ok correct plan!

Test #138:

score: -1
Wrong Answer
time: 22ms
memory: 52504kb

input:

3000
1400
1739
2183
418
1406
1753
552
1164
651
10
607
12
162
2581
379
1030
419
1772
642
590
533
289
1805
1783
2446
1576
1585
200
277
2525
2939
1210
174
688
2188
1032
37
1107
385
1306
375
531
2341
1267
1616
46
402
1844
2669
1066
434
22
377
740
240
1202
2879
2019
2471
836
799
2182
396
2764
2768
2610
1...

output:

2
2446
2835 2773 2707 2675 2646 2629 2622 2574 2554 2551 2545 2483 2420 2677 2897 2344 2343 2457 2567 2321 2455 2295 2275 2265 2242 2226 2225 2189 2165 2125 2113 2062 2059 2051 2047 2769 2218 2042 2280 2037 2031 2010 1997 1996 1993 1973 1972 1950 1939 1927 2910 1921 1913 1911 1908 1905 2607 2057 189...

result:

wrong answer invalid operation #1: duplicated elements