QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#263853#7771. 不是这一道据数构结题ucup-team1004#0 63ms10008kbC++14902b2023-11-25 09:01:412024-07-04 03:08:48

Judging History

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

  • [2024-07-04 03:08:48]
  • 评测
  • 测评结果:0
  • 用时:63ms
  • 内存:10008kb
  • [2023-11-25 09:01:41]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#ifdef DEBUG
template<class T>
ostream& operator << (ostream &out,vector<T> a){
	out<<'[';
	for(T x:a)out<<x<<',';
	return out<<']';
}
template<class T>
vector<T> ary(T *a,int l,int r){
	return vector<T>{a+l,a+1+r};
}
template<class T>
void debug(T x){
	cerr<<x<<endl;
}
template<class T,class...S>
void debug(T x,S...y){
	cerr<<x<<' ',debug(y...);
}
#else
#define debug(...) void()
#endif
const int N=1e6+10;
int n,m,a[N],pre[N],suf[N];
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(int l,r;m--;){
		scanf("%d%d",&l,&r);
		pre[l-1]=n+1,suf[r+1]=0;
		for(int i=l;i<=r;i++)pre[i]=min(pre[i-1],a[i]);
		for(int i=r;i>=l;i--)suf[i]=max(suf[i+1],a[i]);
		int ans=0;
		for(int i=l;i<=r;i++)ans+=pre[i]==a[i]&&suf[i]==a[i];
		printf("%d\n",(r-l+1)-ans);
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 7864kb

input:

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

output:

66
92
18
8
12
2
57
22
0
12
49
9
4
14
7
38
12
87
3
54
37
0
46
67
45
22
4
31
42
24
52
54
33
18
35
39
37
9
56
40
16
3
11
4
42
87
47
9
2
36
18
79
15
59
20
58
46
10
68
41
17
79
48
56
13
31
81
8
5
66
38
20
6
36
31
40
43
3
8
19
15
18
40
59
64
50
34
11
9
17
24
67
51
0
42
47
2
24
7
0

result:

wrong answer 1st numbers differ - expected: '65', found: '66'

Test #2:

score: 0
Wrong Answer
time: 1ms
memory: 7996kb

input:

100 100
2 3 1 3 3 8 1 1 1 3 2 3 2 75 1 44 78 3 3 65 2 1 3 3 90 2 1 1 1 2 2 2 1 2 9 3 24 1 2 1 89 2 2 42 2 66 1 1 19 25 3 2 3 2 3 51 1 1 3 1 3 29 21 2 2 2 1 2 1 3 3 2 84 2 1 11 2 2 3 2 9 1 1 1 1 99 48 1 77 3 9 78 69 1 2 1 1 2 1 2
21 68
41 76
9 76
7 43
30 81
45 84
81 83
23 45
57 91
17 65
72 81
39 91
3...

output:

48
35
68
37
52
37
0
23
35
49
10
53
44
9
64
37
64
37
42
73
15
5
47
15
72
31
66
79
15
79
69
37
11
38
32
7
38
69
18
22
80
39
30
68
68
6
6
70
10
36
14
13
35
32
37
20
38
73
36
25
9
62
55
4
58
45
82
67
39
29
61
21
24
37
24
5
15
2
6
48
4
20
90
57
27
13
18
19
81
13
23
35
65
54
41
60
67
35
12
75

result:

wrong answer 1st numbers differ - expected: '35', found: '48'

Test #3:

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

input:

3000 3000
82 1139 2770 344 363 880 427 2001 207 2969 1309 2063 2349 1817 1869 2724 2380 1887 1377 1422 1732 449 2105 1706 1155 2417 963 308 1996 2788 737 1963 1973 1163 2899 2438 760 1995 1435 1750 1947 2863 1606 1078 493 2922 1478 607 1871 2191 2978 2587 1699 332 1581 2048 68 350 2220 1306 1633 187...

output:

1465
909
1100
256
2578
11
1177
330
1716
2228
628
48
1354
1453
639
2747
1025
834
638
606
990
1108
1133
1187
153
2261
979
993
641
1105
686
2320
1893
163
1157
1114
1683
784
733
2044
478
335
984
890
2091
6
1261
984
616
1050
1376
1506
1821
1159
1169
600
658
296
24
171
2605
1664
1980
1665
1041
1134
157
48...

result:

wrong answer 1st numbers differ - expected: '1464', found: '1465'

Test #4:

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

input:

3000 3000
2120 271 658 684 1092 795 2522 2924 2204 382 709 1351 2977 1639 1190 2472 458 1337 1034 566 2644 664 1224 1410 1820 625 2203 2045 1979 2297 2926 1238 2014 1492 1372 2594 1324 1854 1968 1074 919 2345 1544 1880 626 2505 1742 1427 2892 99 447 1732 2273 2490 1166 2419 2717 1248 2493 1048 2291 ...

output:

1080
885
1833
58
332
106
2423
581
1211
1591
479
1120
2743
1548
1249
59
1401
1047
828
271
460
867
251
1302
1823
281
224
1049
2448
1176
2464
423
804
79
368
847
875
1007
423
992
724
450
344
2533
383
1164
2693
257
26
214
1700
806
44
1080
337
4
5
118
1652
1875
691
742
72
408
2428
785
470
1291
2060
755
10...

result:

wrong answer 1st numbers differ - expected: '1079', found: '1080'

Test #5:

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

input:

3000 3000
2637 1681 2145 1131 33 618 2714 914 2587 2182 1823 1044 1320 2020 568 2 411 902 523 2075 910 459 124 669 1546 2593 1314 312 2736 1408 1578 28 291 1017 421 798 2202 978 597 2246 1349 1486 2756 2464 1912 636 1130 201 648 882 2737 2066 2007 1758 91 2923 49 1288 2254 776 2814 1315 1665 2306 25...

output:

709
480
1014
1844
196
1486
1285
2306
88
1742
2239
307
259
855
1436
2490
1698
872
1640
337
1072
735
375
28
860
1514
1478
237
373
1482
93
780
177
169
960
1534
815
1220
140
1471
575
552
449
110
28
2112
1462
1260
1271
264
11
226
585
1441
1798
1899
178
959
1422
1302
574
508
1611
986
440
1572
652
2453
118...

result:

wrong answer 1st numbers differ - expected: '708', found: '709'

Test #6:

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

input:

3000 3000
15 64 32 83 23 22 48 7 68 36 43 75 29 17 37 97 92 42 50 87 73 43 12 48 83 44 1 13 23 96 48 60 99 26 2 104 73 73 64 61 64 49 67 94 89 9 96 102 66 19 95 2 29 78 102 61 77 84 34 92 36 31 44 25 68 47 137 131 75 37 21 173 62 44 36 53 19 165 98 100 95 57 85 32 87 69 118 85 24 35 36 98 47 44 92 2...

output:

473
726
431
452
1181
1817
589
779
631
674
1085
884
2840
522
1191
297
2034
381
1932
1482
515
2141
471
1309
411
1184
359
499
411
928
1265
23
38
1699
296
1741
842
566
2547
219
866
996
710
718
5
2291
267
60
168
668
892
29
1058
2213
659
1221
435
1849
572
2205
898
1433
123
1915
1706
541
14
2156
2566
1391
...

result:

wrong answer 1st numbers differ - expected: '467', found: '473'

Test #7:

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

input:

3000 3000
96 48 34 1 27 93 76 3 38 26 79 74 25 95 34 37 5 26 54 37 62 22 17 3 53 34 10 132 64 91 53 34 74 92 64 3 103 38 74 40 31 38 63 12 84 84 80 5 88 22 51 66 28 158 16 31 26 53 47 22 66 89 7 65 91 49 62 73 26 54 13 33 28 45 48 90 91 46 37 34 53 69 70 52 62 71 56 190 154 72 25 6 17 196 66 39 80 5...

output:

1499
793
363
126
302
1017
787
346
662
378
1882
535
308
1494
2323
211
1108
1074
1377
901
1246
1847
1702
66
636
185
922
1730
747
733
302
352
1649
50
67
110
1696
1274
1972
912
1357
360
179
159
121
1871
1797
1237
136
369
773
1510
1647
341
223
61
1134
1654
856
1346
470
269
932
258
927
2247
1780
226
104
1...

result:

wrong answer 1st numbers differ - expected: '1486', found: '1499'

Test #8:

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

input:

3000 3000
24 75 55 19 9 74 4 22 81 77 75 46 60 50 19 50 1 41 8 63 4 47 93 24 105 16 28 76 18 96 1 68 46 80 41 83 78 36 88 45 83 54 67 46 94 99 44 61 14 50 143 97 95 78 8 92 36 59 95 26 67 23 26 95 77 92 98 13 63 149 129 61 74 39 38 55 15 90 48 3 37 39 100 77 18 10 19 10 20 77 71 46 65 84 46 7 175 81...

output:

1595
105
36
1439
1149
1149
8
166
190
1888
493
1156
1429
1536
2
1459
296
632
746
667
2340
533
514
56
348
19
986
280
1053
14
51
1107
635
343
537
2114
636
239
106
86
728
735
1235
498
1649
1427
1796
596
213
162
111
2032
684
2408
1481
1989
732
555
1526
267
67
834
756
2616
834
1267
344
1966
2130
318
2162
...

result:

wrong answer 1st numbers differ - expected: '1585', found: '1595'

Test #9:

score: 0
Wrong Answer
time: 58ms
memory: 7980kb

input:

10000 10000
1225 3839 1022 812 2195 8154 9848 3399 6401 5375 4192 5933 7758 9460 5569 6817 1504 104 7537 509 3830 3790 686 416 5452 4214 2651 2825 5881 4373 2118 8244 8803 5866 1737 5206 3037 4862 5976 2871 9541 6867 2024 8451 7815 1083 5523 8874 1745 828 8022 5706 3404 651 4212 8126 2555 6660 5481 ...

output:

2318
3600
3098
8538
196
961
802
3059
2038
2028
1542
2198
2834
772
5562
4432
1302
2066
257
3480
6755
2227
3447
83
8994
3658
6012
6247
599
6586
3468
5991
791
2677
4615
3818
6508
5411
5633
3389
8483
3404
4105
761
3380
2559
1640
452
3112
2319
6119
1230
6213
121
326
1896
2080
762
1646
962
6469
4079
544
2...

result:

wrong answer 1st numbers differ - expected: '2317', found: '2318'

Test #10:

score: 0
Wrong Answer
time: 63ms
memory: 10008kb

input:

10000 10000
4293 5943 4058 5440 7413 5250 1171 9947 4399 9939 5300 6419 5446 2275 8834 6841 1566 3814 2298 5294 8131 603 2736 4135 946 7071 3233 6196 6458 5162 8229 3087 227 828 7544 3423 7594 4496 8790 4052 8704 3088 7330 7269 5010 9400 9399 3819 302 4258 2985 3323 6455 5755 7489 321 501 3299 2026 ...

output:

2272
2654
445
7141
3434
90
4846
1493
1888
8438
6862
8574
4646
794
3693
253
3904
1327
241
5381
5857
7999
870
936
3333
9303
3510
5280
2657
4560
250
3230
183
7171
7703
2817
2147
344
6989
2397
4376
5392
3240
3599
5486
4817
1365
1059
2126
2866
1457
1489
1428
2609
1076
5965
2399
3961
3401
40
211
867
2767
...

result:

wrong answer 1st numbers differ - expected: '2271', found: '2272'

Test #11:

score: 0
Wrong Answer
time: 63ms
memory: 8016kb

input:

10000 10000
7 178 96 109 117 3 170 302 209 84 248 310 97 70 222 255 276 127 233 219 109 282 8 182 20 128 75 158 39 214 102 260 13 80 276 221 271 319 129 110 72 89 254 45 34 322 310 299 305 32 93 224 5 261 126 140 311 81 100 72 328 312 42 16 231 146 72 238 178 178 179 226 314 152 167 202 295 258 15 2...

output:

3550
3502
6397
273
976
2125
808
3978
2814
9
254
1436
9086
2848
5805
4735
5150
4199
1827
2038
407
5463
6153
2821
4774
3136
24
2014
98
832
4176
4464
313
3884
9022
7848
2115
1776
8011
655
3287
1359
8595
1745
4761
5982
139
5256
3426
867
6282
849
1854
8049
1751
1707
1456
3932
4345
979
1345
3150
4979
4564...

result:

wrong answer 1st numbers differ - expected: '3540', found: '3550'

Test #12:

score: 0
Wrong Answer
time: 58ms
memory: 7972kb

input:

10000 10000
3 31 195 326 322 174 300 177 87 56 74 14 39 240 134 249 176 187 87 118 177 304 269 44 128 328 112 121 96 93 140 163 209 271 29 296 232 309 228 183 238 100 66 118 204 90 156 45 204 126 232 68 318 327 5 3 153 331 180 62 308 172 175 142 88 318 236 75 276 251 67 218 28 118 141 257 65 151 183...

output:

1101
1592
3521
1035
6221
8342
2868
5749
1104
2351
646
2491
471
1129
3825
6103
624
2980
3771
395
3688
3755
4713
6433
4536
8150
6129
422
1504
1259
1169
5110
402
4428
1601
6354
4465
3987
4627
5335
3849
1104
187
4355
9177
1904
9197
210
517
2412
2287
9336
2474
3214
1903
2263
5607
1257
1526
561
7415
2507
...

result:

wrong answer 1st numbers differ - expected: '1097', found: '1101'

Test #13:

score: 0
Time Limit Exceeded

input:

200000 200000
120536 165588 195015 67563 60504 93355 188680 98879 30412 35909 162690 193085 79065 58869 51576 146413 166618 182838 56146 110147 142857 111033 186246 180779 63081 24777 52683 191278 98735 11504 115999 116939 157422 109468 175004 10755 112531 71163 35398 71262 141229 231 123311 168965 ...

output:

75090
92571
57629
28643
48924
56561
82970
66697
28324
166432
483
38953
118471
122073
50230
3058
79232
79204
13576
72988
45709
144207
30495
58346
162786
75576
74035
10827
4346
9721
140845
20907
52955
88402
63117
19345
118671
165377
112255
89818
57447
88389
122828
55233
102434
128216
134658
2815
13354...

result:


Test #14:

score: 0
Time Limit Exceeded

input:

200000 200000
5203 2776 2051 83 5255 4479 6328 3395 5764 3079 4020 4235 31 62 2282 1983 4052 5141 6514 108 45 84 2874 2225 5833 2277 5069 777 3458 4312 6577 1083 18 6003 4773 1935 2908 91 843 5317 6643 103 5581 113 6234 3738 144 3953 1234 396 4543 3518 5508 1833 1674 1446 1134 6455 4343 558 658 3664...

output:

68601
42029
31653
94139
14383
59439
125014
172556
42663
96601
17562
140916
1163
174134
6119
9901
118439
85280
52895
20165
20157
9456
113425
187720
23801
82053
38167
84965
116352
22783
56593
55150
59225
34401
101159
44238
49113
34705
18448
3681
47379
13862
126013
60033
56200
7171
117308
132384
53671
...

result:


Test #15:

score: 0
Time Limit Exceeded

input:

200000 200000
5102 3159 748 5427 621 5896 499 5528 1847 6008 961 3084 1541 3370 3477 6551 3122 34 60 5045 1000 2091 119 35 345 92 47 6200 2305 611 27 20 4462 37 1192 108 5020 6490 5834 2997 6615 4662 102 4466 3073 634 2393 278 6122 6451 4679 4161 2316 2074 4859 782 3340 3997 6350 6659 4747 2199 5225...

output:

40302
786
17319
4348
89994
20183
75801
134679
58700
21705
83935
48408
54819
119893
40564
150281
124768
14796
160830
97968
47906
108016
71597
16828
48017
10222
57949
179424
11861
2879
44406
49572
62169
25924
102002
536
23720
7908
13858
66726
69145
130927
4085
25241
7970
57634
145645
93872
82034
24660...

result:


Test #16:

score: 0
Time Limit Exceeded

input:

200000 200000
5620 4596 1787 1569 11 3679 57 5561 1635 5384 5280 71 127 4084 4074 4 3533 4939 5115 96 336 75 3997 951 133 6410 4574 3466 3102 534 6321 107 2300 2531 5426 73 20 12 101 607 10 4424 5847 134 6212 862 855 5070 77 91 2010 4014 4678 4050 3695 3451 2790 4235 2235 5998 6354 5149 4794 4789 40...

output:

10117
12796
38743
16172
198058
30976
25822
58773
27238
68614
7181
19915
76376
116049
80162
179221
101802
7815
7876
5181
87646
100502
59665
68175
158009
33936
27898
170248
35524
27230
51584
72336
61601
23424
94061
95367
53060
39939
164714
5892
52221
90684
125200
1898
74161
9319
139110
32574
51284
830...

result:


Test #17:

score: 0
Time Limit Exceeded

input:

1000000 1000000
87382 651796 951220 648926 497665 375383 228684 303780 166986 89826 91242 258504 374341 653338 160191 648153 603954 860894 376629 474180 967487 270337 3022 832849 628198 269953 992793 314447 701562 440916 559722 134912 67124 636002 748016 771119 200861 655997 618755 558 882633 709234...

output:

401391
115095
693947
405931
741548
92629
200489
82756
151395
228003
301573
510456
34246
128600
315023
504015
716099
46105
145062
544862
118918
145565
413048
596759
100852
50895
883812
180200
311844
417216
651493
188594
70441
122246
276162
104248
150071
733187
335339
609201
51885
907244
408521
507206...

result:


Test #18:

score: 0
Time Limit Exceeded

input:

1000000 1000000
3228 19 1838 21 15231 54 27226 18805 16744 57 25133 23568 27304 24323 9187 89 14287 13412 20542 21860 23602 65 1 32705 27 20439 19966 70 7865 13967 127 30379 34 95 12820 8224 14188 32692 93 29481 28113 14591 119 7443 2802 6678 51 6838 88 74 7855 95 775 11917 104 18776 34 22985 32134 ...

output:

601780
87980
543643
148210
122261
85820
8160
181385
13907
194239
213331
139437
173157
498629
268393
595816
407090
147648
107034
14142
345537
160973
75779
611056
108848
263613
11066
517147
545515
707811
287962
26602
639847
4460
247025
426994
139159
21860
357767
297220
695774
93736
571718
513913
14232...

result:


Test #19:

score: 0
Time Limit Exceeded

input:

1000000 1000000
13910 7760 24228 1793 79 14626 44 10663 25005 56 4240 15833 3609 19816 13269 28175 8807 67 1480 27123 69 12868 11829 3 18390 5510 58 28157 26708 17269 10176 14025 41 7746 12814 9220 24534 115 12446 51 6256 21293 28779 6845 31048 19928 19877 13972 13317 7203 9974 13131 133 13 5348 166...

output:

149911
626071
592294
104663
180046
665744
132511
790601
318339
111444
27230
177449
318908
202119
522931
250088
266068
306173
869715
340298
43429
690081
490530
148546
558745
328422
440534
667795
674180
327418
120951
251403
476755
316604
798088
255043
307463
809212
159192
146511
692650
450115
677107
2...

result:


Test #20:

score: 0
Time Limit Exceeded

input:

1000000 1000000
15899 2139 32955 19636 21943 29782 28207 9095 20266 68 15471 14533 17782 21804 31540 21751 19168 15466 19302 34 24617 3544 66 31466 31516 3341 30147 6947 26716 135 11544 50 30167 5 11 7820 149 5146 32617 20175 23019 23260 8830 16538 88 2357 22200 21845 2144 12436 104 31 24930 10455 1...

output:

127370
622426
88972
350122
62063
220829
468823
369360
696639
227043
194507
770568
698573
327861
58034
172061
19270
81503
11206
448634
621743
574041
298981
855996
21124
532379
932579
240277
256811
655264
96672
280072
640386
191922
328379
350255
422647
246035
781641
152854
111853
532546
705789
191470
...

result: