QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#571761#9310. Permutation Counting 4ship2077#TL 842ms194040kbC++23573b2024-09-18 08:15:042024-10-14 07:43:44

Judging History

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

  • [2024-10-14 07:43:44]
  • 管理员手动重测本题所有获得100分的提交记录
  • 测评结果:TL
  • 用时:842ms
  • 内存:194040kb
  • [2024-09-18 14:56:40]
  • hack成功,自动添加数据
  • (/hack/835)
  • [2024-09-18 14:41:06]
  • hack成功,自动添加数据
  • (/hack/831)
  • [2024-09-18 08:15:05]
  • 评测
  • 测评结果:100
  • 用时:809ms
  • 内存:194016kb
  • [2024-09-18 08:15:04]
  • 提交

answer

#include<bits/stdc++.h>
#include<bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
constexpr int M=1e6+5;
set<int>s[M];int n;
void solve(){ cin>>n;
	for (int i=1;i<=n;i++) s[i].clear();
	for (int i=1;i<=n;i++){
		int l,r;cin>>l>>r;
		s[l].insert(r);
	}
	for (int i=1;i<=n;i++){
		if (s[i].empty()) return puts("0"),void();
		int lst=0;
		for (auto x:s[i]){
			if (lst) s[lst+1].insert(x);
			lst=x;
		}
	}
	puts("1");
}
int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int T;cin>>T;while (T--) solve();return 0;
}

详细

Test #1:

score: 100
Accepted
time: 8ms
memory: 50496kb

input:

4
5
1 2
1 5
1 2
1 2
2 2
5
1 1
2 4
2 3
5 5
3 4
5
3 5
1 2
3 4
3 5
3 3
5
1 5
1 4
4 5
5 5
1 2

output:

0
1
0
0

result:

ok 4 tokens

Test #2:

score: 0
Accepted
time: 133ms
memory: 50552kb

input:

66725
14
7 7
4 6
7 8
8 13
2 13
6 13
6 10
14 14
1 10
9 11
7 9
3 8
4 12
5 12
12
2 6
3 6
7 11
2 5
1 1
6 12
8 12
2 3
7 9
7 8
1 10
1 4
10
4 8
4 4
6 10
9 10
2 3
2 7
1 3
3 4
2 2
3 10
20
3 12
10 14
19 20
19 20
1 9
7 9
13 16
17 17
16 18
2 11
5 19
6 17
11 17
3 6
3 11
7 20
8 17
3 18
10 15
9 20
16
5 10
2 10
2 1...

output:

1
1
0
0
1
0
1
1
0
1
1
0
0
0
0
0
1
0
1
0
0
1
0
0
0
1
0
1
0
0
0
0
1
0
1
1
1
1
1
0
1
0
1
1
1
1
1
1
1
1
0
1
1
0
0
0
0
0
0
1
0
1
1
0
1
1
1
0
1
0
1
0
0
0
1
1
1
0
0
1
1
1
1
0
1
1
1
1
1
1
1
0
1
0
0
1
1
0
0
1
1
0
0
1
1
1
1
1
1
0
0
1
1
1
0
0
1
1
0
0
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
1
1
1
1
1
0
0
0
1
0
0
1
0
1
1
...

result:

ok 66725 tokens

Test #3:

score: 0
Accepted
time: 148ms
memory: 50628kb

input:

6655
155
28 58
68 100
6 47
98 109
11 133
38 153
73 118
126 153
24 43
71 118
109 135
6 104
40 101
24 139
100 136
135 136
40 148
70 117
92 124
63 64
45 55
16 128
65 86
20 49
126 138
30 141
127 146
21 155
49 139
27 34
39 145
20 53
12 41
3 107
38 78
106 109
61 102
20 99
134 135
23 99
10 69
105 113
36 75...

output:

0
0
1
1
0
1
0
0
1
1
0
1
1
1
0
0
1
1
1
0
1
0
1
0
1
0
0
1
1
0
1
0
0
0
1
1
0
1
0
1
0
1
0
1
1
1
1
0
1
0
0
0
0
0
1
1
0
1
0
1
0
1
0
1
0
0
1
0
0
1
0
0
0
1
0
1
1
0
1
0
0
0
0
0
0
1
0
1
0
0
1
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
1
1
0
0
0
0
0
1
0
1
0
1
0
0
0
0
1
0
1
0
0
1
0
1
0
0
1
0
1
0
0
1
1
1
0
0
0
0
...

result:

ok 6655 tokens

Test #4:

score: 0
Accepted
time: 178ms
memory: 50904kb

input:

666
1967
396 1664
818 1954
564 805
1106 1322
568 1687
853 1482
153 1092
566 670
154 562
114 1372
574 1879
482 1083
499 1566
2 1384
291 1947
122 1714
1277 1900
740 1024
887 1478
146 254
944 1807
574 1193
225 1933
43 1278
1017 1482
958 1180
86 1230
1658 1679
980 1542
1044 1127
762 989
1128 1567
552 17...

output:

0
0
0
0
1
1
1
0
0
0
0
0
0
1
1
0
0
0
1
0
0
0
0
1
1
1
0
0
0
0
1
1
0
0
1
0
1
0
1
0
0
1
0
0
1
0
0
0
0
0
1
1
0
1
1
1
1
0
1
1
1
1
1
0
1
0
0
0
0
1
1
0
0
1
0
1
1
0
1
0
0
1
1
1
1
1
0
1
1
1
0
0
1
0
0
0
0
0
1
0
0
0
0
1
1
0
1
1
1
1
1
0
1
1
0
1
0
0
1
1
1
1
1
0
0
1
1
0
0
1
0
0
1
0
1
1
0
1
1
1
1
1
1
0
0
0
0
1
1
0
...

result:

ok 666 tokens

Test #5:

score: 0
Accepted
time: 319ms
memory: 53692kb

input:

67
12220
945 3456
3457 11698
945 3023
945 10249
945 6035
3457 12211
3024 9082
6554 10249
3179 11698
945 2449
3457 6897
945 3625
4115 9082
3626 11593
2450 3525
3526 5410
3179 5606
5607 8510
5607 8159
1908 9082
6898 9270
3457 4922
6669 9082
2936 10249
2936 9009
1796 5410
4923 10474
2450 5488
3526 6232...

output:

1
1
0
1
1
1
0
0
0
1
0
0
0
0
1
1
1
1
1
0
0
0
0
1
1
0
0
1
0
0
1
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
1
0
1
1
0
1
1
1
0
1
1
0
0
1
1
1
1
0
1

result:

ok 67 tokens

Test #6:

score: 0
Accepted
time: 509ms
memory: 75932kb

input:

6
189286
20378 70057
112636 186453
18829 100288
79275 115176
63489 100397
91394 117835
82935 156201
139293 142914
73817 98058
45394 109570
29456 122157
137106 187436
155188 173045
78214 89538
128432 165866
151755 155927
10312 86728
127548 136028
27985 151840
67594 139392
116691 134229
83762 102392
2...

output:

0
0
1
1
1
0

result:

ok 6 tokens

Test #7:

score: 0
Accepted
time: 833ms
memory: 192448kb

input:

1
1000000
94615 809894
94615 262270
762901 809894
762901 765167
94615 555380
94615 515529
473424 762900
262271 698085
36290 809894
294342 809894
473424 706007
94615 725798
725799 966460
602080 966460
51014 762900
338866 473423
93158 338865
28544 698085
416220 966460
6640 555380
215959 698085
253649 ...

output:

1

result:

ok "1"

Test #8:

score: 0
Accepted
time: 331ms
memory: 97508kb

input:

1
1000000
25927 931541
549663 947731
435323 484750
320537 420368
154427 330335
204649 698863
119951 619271
299655 485176
266828 632738
621134 818227
529143 683026
134580 498562
513579 586797
184440 719755
258499 785336
546208 853976
407308 494237
176985 846562
79646 969633
297019 505247
65287 287869...

output:

0

result:

ok "0"

Test #9:

score: 0
Accepted
time: 344ms
memory: 97484kb

input:

1
1000000
708148 839950
121329 290905
510828 569312
437062 892947
18749 896294
40631 125586
207243 247889
51468 93552
440810 694824
29877 145371
453173 456834
215578 649145
278488 353906
492636 676255
590863 913302
23982 765827
558855 973649
259253 402361
415102 552772
283526 306361
586620 693138
27...

output:

0

result:

ok "0"

Test #10:

score: 0
Accepted
time: 803ms
memory: 194040kb

input:

1
1000000
282918 797950
797951 915225
615399 915225
457486 615398
321702 797950
414142 797950
86620 414141
86620 388932
86620 998765
440839 457485
86620 448168
99138 998765
414142 494939
333492 448168
99138 597241
895799 915225
111714 615398
414142 906877
80369 321701
797951 979896
457486 535578
333...

output:

1

result:

ok "1"

Test #11:

score: 0
Accepted
time: 346ms
memory: 97420kb

input:

1
1000000
831328 870733
206720 363737
918611 979445
89822 488412
396737 611744
354139 765908
486638 518418
296801 990821
187722 808282
80742 649459
738441 819473
242541 441310
158310 764373
110901 879938
204155 274087
119096 414236
296080 877904
523676 628788
492136 579838
599930 731872
14581 265820...

output:

0

result:

ok "0"

Test #12:

score: 0
Accepted
time: 842ms
memory: 188972kb

input:

1
1000000
250412 737666
737667 993185
861375 993185
721908 993185
209954 721907
737667 789700
435283 737666
164916 209953
149936 861374
209954 559650
69081 250411
298411 721907
173631 861374
57828 298410
435283 892327
863076 892327
283363 298410
3290 721907
789701 949793
559651 985187
3290 755642
32...

output:

1

result:

ok "1"

Test #13:

score: 0
Accepted
time: 347ms
memory: 97448kb

input:

1
1000000
318973 779919
438410 978223
455585 723466
308013 977990
263871 538496
86744 501121
72052 419373
15911 268439
499883 527765
679230 868802
330840 803740
380942 392943
65937 674331
288146 672318
694032 909594
213386 345973
452124 929529
262584 931207
24900 750763
254895 600549
851295 950130
1...

output:

0

result:

ok "0"

Test #14:

score: 0
Accepted
time: 352ms
memory: 97436kb

input:

1
1000000
239440 968541
377517 869195
530856 816462
232729 422351
11399 612034
430469 766063
401926 402352
522675 872089
478392 926439
146525 555357
543387 701528
402678 760896
712375 818266
21282 619683
352812 426092
289076 482125
874816 973856
53811 333775
218802 267228
65809 292143
676521 982871
...

output:

0

result:

ok "0"

Test #15:

score: 0
Accepted
time: 359ms
memory: 97304kb

input:

1
1000000
499131 501875
7544 495774
133830 316225
13323 142112
218559 877222
137527 418509
138614 248102
84060 395886
345499 494655
166777 315709
373952 878560
734659 950965
38749 967905
699108 701549
135426 572760
136007 898008
666899 950808
547838 553056
702428 943307
386478 629552
564870 694439
6...

output:

0

result:

ok "0"

Test #16:

score: 0
Accepted
time: 341ms
memory: 97304kb

input:

1
1000000
20752 494590
443015 633649
748804 831912
498508 583322
25172 224797
198063 709209
265567 760531
169111 263603
88340 150378
683819 685360
816602 953394
3949 336072
512193 890817
198122 812621
30617 612527
721756 877615
291877 727436
540881 917775
131459 714576
413668 542545
142171 778729
37...

output:

0

result:

ok "0"

Extra Test:

score: -3
Extra Test Failed : Time Limit Exceeded on 3

input:

1
1000000
1 1
1 2
2 3
1 4
2 5
3 6
4 7
1 8
2 9
3 10
4 11
5 12
6 13
7 14
8 15
1 16
2 17
3 18
4 19
5 20
6 21
7 22
8 23
9 24
10 25
11 26
12 27
13 28
14 29
15 30
16 31
1 32
2 33
3 34
4 35
5 36
6 37
7 38
8 39
9 40
10 41
11 42
12 43
13 44
14 45
15 46
16 47
17 48
18 49
19 50
20 51
21 52
22 53
23 54
24 55
25...

output:


result: