QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#613713#9428. Be Positiverotcar07AC ✓250ms50444kbC++20554b2024-10-05 14:34:172024-10-05 14:34:21

Judging History

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

  • [2024-10-05 14:34:21]
  • 评测
  • 测评结果:AC
  • 用时:250ms
  • 内存:50444kb
  • [2024-10-05 14:34:17]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int t;cin>>t;
    while(t--){
        int n;cin>>n;
        set<int> s;int cur=0;
        for(int i=0;i<n;i++) s.insert(i),cur^=i;
        if(!cur){puts("impossible");continue;}
        vector<int> v;
        for(int i=0;i<n-1;i++){
            auto w=prev(s.end());if(*w==cur)w=prev(w);
            v.push_back(*w),cur^=*w,s.erase(w);
        }
        v.push_back(cur);reverse(v.begin(),v.end());
        for(auto x:v) cout<<x<<' ';cout<<'\n';
    }
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3584kb

input:

4
1
2
3
4

output:

impossible
1 0 
1 0 2 
impossible

result:

ok 4 test cases (4 test cases)

Test #2:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

10
1
2
3
4
5
6
7
8
9
10

output:

impossible
1 0 
1 0 2 
impossible
1 0 2 4 3 
1 0 2 4 3 5 
1 0 2 4 3 5 6 
impossible
1 0 2 4 3 5 6 8 7 
1 0 2 4 3 5 6 8 7 9 

result:

ok 10 test cases (10 test cases)

Test #3:

score: 0
Accepted
time: 89ms
memory: 3652kb

input:

1413
1392
1306
297
726
1353
1059
111
758
1409
843
1013
940
1186
788
60
230
1249
209
776
966
178
25
168
494
70
867
601
195
718
497
1161
323
1054
265
148
388
186
539
760
1184
1230
829
400
460
1253
922
903
42
1347
1368
404
512
1170
378
136
560
1078
612
1201
30
717
934
572
975
255
1131
319
629
264
1240
...

output:

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

result:

ok 1413 test cases (1413 test cases)

Test #4:

score: 0
Accepted
time: 93ms
memory: 3696kb

input:

585
1673
1844
1665
1924
1686
1682
1707
1753
1865
1713
1777
1568
1959
1615
1623
1710
1483
1509
1510
1735
1996
1879
1699
1691
1750
1906
1620
1986
1563
1565
1523
1920
1562
1473
1860
1577
1717
1835
1425
1532
1877
1742
1977
1809
1856
1775
1663
1793
1684
1605
1913
1748
1564
1933
1433
1428
1419
1790
1864
1...

output:

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

result:

ok 585 test cases (585 test cases)

Test #5:

score: 0
Accepted
time: 92ms
memory: 3872kb

input:

449
2279
2327
2342
2005
2188
2302
2018
2272
2167
2210
2447
2034
2273
2335
2415
2007
2152
2392
2215
2141
2166
2248
2110
2039
2239
2200
2355
2379
2056
2078
2169
2137
2151
2081
2312
2405
2077
2177
2361
2438
2024
2328
2011
2212
2290
2133
2396
2123
2300
2409
2338
2131
2158
2339
2243
2421
2422
2009
2297
2...

output:

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

result:

ok 449 test cases (449 test cases)

Test #6:

score: 0
Accepted
time: 97ms
memory: 3684kb

input:

379
2515
2646
2815
2449
2581
2563
2797
2461
2487
2546
2625
2562
2482
2635
2749
2603
2573
2491
2636
2507
2524
2462
2609
2614
2752
2706
2457
2586
2539
2673
2791
2813
2613
2672
2544
2504
2649
2622
2708
2593
2663
2630
2534
2647
2670
2497
2773
2822
2774
2472
2626
2463
2741
2727
2535
2620
2754
2502
2475
2...

output:

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

result:

ok 379 test cases (379 test cases)

Test #7:

score: 0
Accepted
time: 89ms
memory: 3776kb

input:

334
2843
2990
2834
2912
2867
2902
2953
2871
3095
3031
2940
3051
3069
2963
2916
3058
2854
3117
2945
2840
3127
3110
3157
2943
2998
3013
2868
2984
2865
2848
2835
2860
2909
3027
3064
3089
2960
3054
2921
3074
3066
2947
3080
2903
3139
2941
2969
2987
2955
3096
3084
3109
2966
3114
3160
2981
2911
3024
2839
3...

output:

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

result:

ok 334 test cases (334 test cases)

Test #8:

score: 0
Accepted
time: 93ms
memory: 3996kb

input:

301
3370
3276
3248
3172
3419
3284
3181
3187
3167
3408
3233
3223
3185
3198
3397
3285
3333
3317
3451
3456
3299
3186
3168
3405
3296
3250
3227
3414
3314
3404
3361
3224
3411
3322
3243
3443
3337
3388
3450
3170
3358
3188
3239
3424
3235
3446
3331
3394
3261
3359
3288
3210
3297
3441
3205
3328
3409
3380
3308
3...

output:

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

result:

ok 301 test cases (301 test cases)

Test #9:

score: 0
Accepted
time: 90ms
memory: 3928kb

input:

277
3668
3548
3547
3617
3523
3715
3583
3694
3480
3572
3486
3536
3602
3538
3517
3483
3494
3600
3627
3669
3504
3695
3710
3659
3462
3558
3593
3662
3584
3482
3589
3481
3625
3590
3474
3626
3636
3691
3681
3575
3516
3469
3647
3670
3528
3723
3597
3492
3534
3612
3573
3595
3542
3586
3629
3655
3554
3577
3608
3...

output:

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

result:

ok 277 test cases (277 test cases)

Test #10:

score: 0
Accepted
time: 99ms
memory: 3704kb

input:

258
3947
3943
3817
3784
3966
3883
3941
3783
3880
3875
3774
3967
3852
3877
3856
3748
3767
3853
3779
3950
3955
3983
3855
3873
3776
3939
3920
3961
3791
3785
3885
3822
3991
3868
3952
3829
3802
3878
3904
3886
3988
3942
3984
3745
3900
3850
3805
3931
3938
3786
3929
3995
3974
3906
3994
3789
3810
3750
3843
3...

output:

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

result:

ok 258 test cases (258 test cases)

Test #11:

score: 0
Accepted
time: 100ms
memory: 3804kb

input:

242
4171
4126
4222
4051
4224
4099
4021
4060
4127
4019
4135
4078
4138
4005
4017
4006
4155
4094
4223
4172
4227
4117
4100
4170
4228
4209
4103
4163
4098
4048
4210
4151
4018
4154
4111
4069
4041
4191
4215
4212
4044
4106
4052
4207
4112
4002
4221
4152
4133
4064
4080
4175
4091
4033
3999
4084
4195
4166
4012
4...

output:

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

result:

ok 242 test cases (242 test cases)

Test #12:

score: 0
Accepted
time: 97ms
memory: 3796kb

input:

229
4261
4406
4284
4365
4277
4280
4427
4313
4353
4369
4249
4339
4345
4412
4265
4415
4426
4240
4439
4266
4441
4456
4255
4452
4332
4262
4343
4260
4366
4447
4244
4329
4242
4338
4324
4350
4430
4399
4318
4411
4393
4404
4397
4292
4276
4465
4378
4314
4434
4379
4380
4254
4451
4322
4422
4320
4445
4387
4342
4...

output:

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

result:

ok 229 test cases (229 test cases)

Test #13:

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

input:

1
999996

output:

impossible

result:

ok 1 test cases (1 test case)

Test #14:

score: 0
Accepted
time: 246ms
memory: 50444kb

input:

1
999997

output:

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

result:

ok 1 test cases (1 test case)

Test #15:

score: 0
Accepted
time: 250ms
memory: 50436kb

input:

1
999998

output:

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

result:

ok 1 test cases (1 test case)

Test #16:

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

input:

1
999999

output:

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

result:

ok 1 test cases (1 test case)

Test #17:

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

input:

1
1000000

output:

impossible

result:

ok 1 test cases (1 test case)

Extra Test:

score: 0
Extra Test Passed