QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#250756 | #7771. 不是这一道据数构结题 | zhouhuanyi | 60 | 72ms | 5740kb | C++14 | 659b | 2023-11-13 17:00:54 | 2023-11-13 17:00:55 |
Judging History
answer
#include<iostream>
#include<cstdio>
#define N 1000000
using namespace std;
int read()
{
char c=0;
int sum=0;
while (c<'0'||c>'9') c=getchar();
while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
return sum;
}
int n,q,cnt[N+1],a[N+1],ans;
int main()
{
int l,r,minn;
n=read(),q=read();
for (int i=1;i<=n;++i) a[i]=read();
while (q--)
{
l=read(),r=read(),ans=0,minn=n;
for (int j=1;j<=n;++j) cnt[j]=0;
for (int j=l;j<=r;++j) cnt[a[j]]++;
for (int j=n-1;j>=1;--j) cnt[j]+=cnt[j+1];
for (int j=l;j<=r;++j)
{
minn=min(minn,a[j]);
if (cnt[minn+1]>=j-l+1) ans++;
}
printf("%d\n",ans);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 5
Accepted
time: 1ms
memory: 5600kb
input:
100 100 37 77 8 56 29 7 65 28 3 49 97 89 18 36 33 54 82 24 83 58 96 64 16 9 2 69 100 1 10 39 99 50 46 78 47 85 53 62 52 41 17 94 70 44 98 59 20 92 4 21 22 0 84 45 25 38 57 13 42 79 74 93 71 88 23 91 81 34 51 68 76 31 40 87 60 90 12 15 86 11 73 95 19 5 55 48 66 35 27 14 67 63 6 30 72 80 61 43 26 75 1...
output:
1 17 62 4 0 27 21 19 58 0 33 10 9 72 3 44 85 22 8 29 17 17 67 40 34 4 4 1 33 15 13 29 56 6 51 12 6 4 0 43 42 12 35 42 29 27 45 32 12 33 55 10 98 9 63 44 16 19 32 37 34 7 8 58 10 12 8 76 14 19 62 57 32 16 59 2 18 21 17 30 28 36 58 62 21 4 58 49 51 14 86 25 24 52 59 22 32 5 50 80
result:
ok 100 numbers
Test #2:
score: 5
Accepted
time: 1ms
memory: 5604kb
input:
100 100 2 1 1 81 2 2 0 1 2 3 25 57 26 3 64 1 21 2 3 3 18 3 2 2 1 1 3 2 1 3 83 3 1 3 94 65 2 1 3 1 2 14 2 3 1 1 3 3 34 57 1 1 72 85 1 2 1 3 2 2 1 3 3 2 1 1 1 2 66 2 1 1 3 3 3 2 3 1 1 3 65 25 95 3 71 1 2 1 17 1 1 1 15 3 3 2 2 3 43 1 9 61 20 69 23 78 28 78 13 97 7 99 22 67 24 25 3 44 33 95 87 95 3 68 1...
output:
39 34 37 34 59 92 30 0 41 41 5 65 26 6 2 44 0 16 18 12 48 21 39 18 21 56 42 56 16 11 33 7 39 20 5 8 4 15 38 20 41 18 44 57 44 15 10 13 16 67 28 16 8 19 9 10 15 9 16 13 1 22 27 15 27 14 29 46 21 43 2 16 2 31 54 36 28 49 35 9 10 38 18 7 33 0 18 13 25 0 13 29 7 12 23 16 15 6 25 30
result:
ok 100 numbers
Test #3:
score: 5
Accepted
time: 7ms
memory: 5608kb
input:
3000 3000 1435 2843 255 1028 1524 1189 918 2858 1259 1648 733 1885 2031 1261 524 685 2965 835 1017 2552 1220 507 139 2981 175 420 455 1203 1957 2487 1009 866 1321 2818 2022 2715 416 2169 2531 2724 1516 2919 581 2201 1049 463 2509 742 2094 937 1927 497 250 632 2900 2160 941 2761 2280 1348 991 2390 21...
output:
751 1826 1605 241 2640 434 1584 505 755 386 298 1281 691 1157 315 1957 928 2129 367 82 84 213 2185 1816 637 52 1120 344 82 2144 2224 986 737 838 299 1208 778 1017 2441 698 100 190 1272 515 1057 2173 1582 1420 181 2085 658 556 799 1006 1594 607 478 689 1363 609 688 686 2351 163 1836 2279 828 2360 179...
result:
ok 3000 numbers
Test #4:
score: 5
Accepted
time: 7ms
memory: 5552kb
input:
3000 3000 2333 2615 2997 210 430 1932 1734 2284 1018 153 2459 2849 1618 1221 2704 959 1853 831 2976 1236 1001 707 1586 535 1649 1641 2147 427 247 1410 267 1362 329 1408 1976 1003 2125 2027 1038 1154 1680 571 2634 166 1706 1381 1194 2889 2492 1036 759 1453 2894 857 59 2755 2329 1072 292 998 1961 789 ...
output:
88 650 820 1367 440 2249 314 160 595 1033 1993 449 1774 1184 1569 1788 402 942 1045 1442 1767 441 317 272 1604 264 51 2313 241 2514 418 2070 1347 293 569 1518 1041 206 1576 286 1727 403 123 1500 2447 1333 2541 8 19 1570 979 1210 2400 1832 2378 516 1084 1020 628 24 956 1222 501 1168 472 2110 1947 810...
result:
ok 3000 numbers
Test #5:
score: 5
Accepted
time: 7ms
memory: 5492kb
input:
3000 3000 1884 281 956 46 1601 645 1200 1015 933 1584 133 1761 1756 616 2888 2475 1664 1516 2642 2997 2124 1192 750 1928 1217 2481 707 522 1690 2949 948 1771 1994 2782 2232 461 2631 836 345 2222 2750 1540 2361 2759 230 813 1379 856 465 669 1366 2166 1888 2527 324 2324 1536 515 2394 2395 1014 2698 22...
output:
777 1407 96 816 304 316 1050 658 1633 1299 491 0 1031 2191 185 1423 1947 1842 2806 380 1795 960 598 2191 877 621 1544 72 169 852 638 413 490 252 77 1991 1731 2615 1475 592 419 256 2363 1371 993 1577 984 256 1847 652 281 766 2776 414 2358 227 894 436 509 1095 1500 10 534 1445 942 1824 560 2388 257 16...
result:
ok 3000 numbers
Test #6:
score: 5
Accepted
time: 7ms
memory: 5584kb
input:
3000 3000 77 37 57 58 90 98 2 50 47 53 17 20 67 31 12 13 82 97 52 26 10 64 6 84 92 55 92 98 68 100 78 29 52 16 33 21 44 22 70 18 88 40 85 151 62 97 12 96 80 44 7 114 23 13 59 97 16 45 94 100 99 24 54 22 72 63 49 93 29 24 59 137 20 2 15 72 16 15 62 41 27 89 92 55 77 18 61 32 80 35 10 22 8 16 94 64 40...
output:
2485 2199 126 895 142 958 1795 2214 184 33 970 1847 1834 4 330 1320 599 82 486 239 1764 1089 240 1329 657 440 1246 730 1135 1848 1386 57 993 1249 233 1153 384 608 827 1364 608 840 836 1401 331 2069 595 1313 772 649 1359 817 312 152 2411 1291 750 603 315 1554 1037 388 177 441 532 2106 1475 280 109 33...
result:
ok 3000 numbers
Test #7:
score: 5
Accepted
time: 7ms
memory: 5524kb
input:
3000 3000 50 40 62 17 17 43 60 2 41 42 7 2 72 72 61 76 42 37 49 19 27 7 83 59 87 81 51 88 60 88 99 60 54 39 41 83 57 92 11 55 125 98 79 62 37 42 156 63 80 75 29 28 95 68 58 50 6 136 7 60 64 19 36 32 92 126 46 37 87 82 32 38 16 32 31 42 58 156 44 66 32 58 97 90 25 83 13 15 27 25 16 90 46 37 87 106 9 ...
output:
315 1115 2058 1242 1319 360 1504 969 787 1383 2786 58 41 443 1113 477 2737 1486 353 784 247 998 1873 251 562 246 1083 680 266 1995 823 1697 422 1023 1765 1396 77 1379 1705 799 1701 66 1849 1035 2261 1791 1824 854 496 1381 720 975 922 427 610 1006 149 1790 505 200 565 940 1512 357 2878 310 283 1194 9...
result:
ok 3000 numbers
Test #8:
score: 5
Accepted
time: 8ms
memory: 5740kb
input:
3000 3000 100 11 8 99 53 36 40 90 73 47 33 67 21 29 7 95 59 17 53 21 59 128 14 115 36 13 27 46 94 70 95 83 74 46 93 44 69 79 76 55 97 54 90 10 97 20 79 85 9 5 56 54 45 25 4 29 87 31 46 73 37 91 16 5 72 139 9 27 16 81 38 87 124 112 38 8 1 52 94 51 98 89 53 14 59 19 4 24 28 171 31 24 50 159 11 7 86 40...
output:
1313 1565 2229 657 1396 69 1170 624 979 17 1116 2188 1743 2106 1485 1641 1094 951 598 532 77 51 1369 1521 1509 775 962 813 195 183 421 2328 977 201 1005 1640 883 185 2625 104 275 1658 582 366 247 1970 1525 484 469 783 1410 2673 650 554 985 810 315 529 576 1675 221 242 745 976 886 453 552 772 2373 49...
result:
ok 3000 numbers
Test #9:
score: 5
Accepted
time: 72ms
memory: 5576kb
input:
10000 10000 1102 1172 4429 4799 5086 6032 109 2039 1834 9108 4155 3616 174 5019 7709 6329 4145 8790 1759 3949 8600 7645 6860 3367 7497 8752 640 3960 5795 1546 113 7805 2919 9562 9125 6588 1573 5789 1910 2795 4075 4000 3189 556 4684 4901 4807 3198 8356 4081 3084 4862 8421 2023 886 1268 8826 2943 8476...
output:
5707 2789 1392 4930 5834 1082 1265 2972 1441 1290 6050 2004 3025 1505 2090 8915 1449 2112 5874 3845 2074 1353 4615 201 8609 8036 3316 1085 3750 3970 7192 6191 2862 3321 3578 2287 2476 4220 446 6890 3911 856 4558 1656 2938 516 238 1130 6428 6538 550 8403 3160 5624 480 5742 2636 4046 4529 4105 2725 10...
result:
ok 10000 numbers
Test #10:
score: 5
Accepted
time: 72ms
memory: 5636kb
input:
10000 10000 4369 5585 4914 2369 2484 2516 1844 5275 6671 860 6424 3722 4807 1752 6554 9590 6670 2923 8872 246 3132 7199 8268 9182 8063 7339 3590 771 8154 9640 5410 8351 4824 3222 3552 7521 4652 7749 1867 7636 257 130 5087 1464 7618 6516 1193 9277 169 4584 9115 363 872 7247 2024 9845 4198 1794 1012 7...
output:
8381 2139 1942 1506 2353 6663 4780 4908 692 3252 9735 2056 6905 2774 5483 325 4662 7387 4020 1007 9674 2548 831 190 5777 4138 7110 4858 3117 6936 1548 6182 2094 3520 3871 4772 5732 4230 4656 3065 1359 3944 4425 7853 1150 1434 1421 7498 4491 5008 8905 1123 8567 1593 159 3546 5141 802 4115 4047 4683 2...
result:
ok 10000 numbers
Test #11:
score: 5
Accepted
time: 71ms
memory: 5648kb
input:
10000 10000 57 224 20 45 172 255 272 72 78 207 118 87 47 80 303 160 269 4 13 292 320 20 71 6 182 28 83 319 67 88 187 51 252 50 289 47 6 104 321 214 161 159 244 41 210 238 255 283 98 179 70 268 65 205 284 265 172 229 26 263 260 101 120 314 26 132 21 215 25 68 133 259 75 141 119 107 224 310 143 282 22...
output:
2203 1362 5746 2409 2772 8337 7358 3535 8447 6307 7217 194 3023 495 9679 1881 2610 1038 5609 5532 3171 7176 3499 6295 3264 994 1269 1918 206 3857 7331 9310 4578 5780 308 2107 1778 7756 1823 3132 2642 2374 4456 2670 3807 3218 5025 8856 6045 2418 6220 4926 5151 2654 6577 1034 2908 1962 2147 5247 2717 ...
result:
ok 10000 numbers
Test #12:
score: 5
Accepted
time: 71ms
memory: 5632kb
input:
10000 10000 270 4 38 86 278 302 39 28 16 65 215 31 96 35 157 44 191 270 241 112 24 181 91 108 109 169 116 25 153 144 141 278 189 205 38 326 311 132 154 160 261 94 64 79 262 63 183 12 199 108 155 49 127 187 107 145 223 139 35 162 91 156 51 162 118 230 10 17 142 172 211 260 95 210 116 285 110 64 218 8...
output:
311 2008 3607 4481 9075 1377 785 760 1326 5482 5130 2984 113 1280 3163 8118 1008 2439 5801 391 2154 3138 7854 6662 2945 4862 3693 5094 758 2399 769 3801 413 2376 2910 6340 2835 8369 2961 6123 2530 5633 7551 3304 9007 131 3396 1529 2221 4372 2418 141 4318 8378 5529 3403 2236 405 5599 2771 5116 1212 5...
result:
ok 10000 numbers
Test #13:
score: 0
Time Limit Exceeded
input:
200000 200000 118934 195992 123246 58080 27980 167359 39421 127657 38819 119579 102077 66026 188968 45737 13734 253 13632 156052 64568 162976 91475 125529 7223 87592 16055 59515 114052 137901 103034 144187 74533 43665 115775 137180 180617 124276 60502 190661 23187 91058 193272 118804 68934 166092 12...
output:
18772 87509 102038 134062 86498 48416 105410 30891 72320 12440 69926 75921 65361 133807 51086 39667 18740 1108 41234 86544 88600 22711 45740 128117 13968 56629 96885 103416 84584 40810 98199 98956 135646 88592 106044 105357 22723 26227 144695 68376 44975 187412 46413 65452 117638 59792 138808 120701...
result:
Test #14:
score: 0
Time Limit Exceeded
input:
200000 200000 5172 5838 4479 6536 311 6198 1477 3852 3083 4176 97 2086 2594 5940 226 51 4090 2516 5146 1888 5016 4570 71 1626 2158 4131 3194 59 5349 2106 2957 814 4271 5251 965 580 130 1515 3874 3713 5128 140 1719 924 53 2623 5400 1158 5047 6136 6205 2362 3816 2838 445 5123 75 2417 5683 520 5188 432...
output:
140230 113785 33351 16681 3183 30464 96922 22612 92099 9002 21560 29206 107153 46506 26780 35172 135374 107557 43679 184235 19940 45114 20577 90625 154100 82861 10547 71505 76307 19645 106112 55406 60657 128201 76892 72922 161388 32111 68422 108776 15418 116259 159835 37273 11691 90437 180052 542 61...
result:
Test #15:
score: 0
Time Limit Exceeded
input:
200000 200000 4888 2130 2294 5011 38 4442 16 1159 5694 2139 98 40 2676 2727 2123 4216 74 127 38 4918 38 3 3102 24 2798 4259 4340 480 3931 2604 4574 5428 1751 80 3186 2827 124 5145 4480 1177 3330 663 1933 114 2582 5143 5326 5736 5157 3862 3279 133 21 30 53 1056 5592 21 3018 18 22 148 5662 1489 2092 5...
output:
154107 164120 95308 28384 144398 118625 5569 45695 108269 91850 130484 186432 15888 139126 11827 48761 5239 128596 24957 177807 21338 77669 17354 59779 122557 68565 26794 140971 66850 1900 109287 61517 108509 71716 3308 122313 52516 100 63518 43376 46205 101913 90430 7786 2729 96561 40356 69774 1942...
result:
Test #16:
score: 0
Time Limit Exceeded
input:
200000 200000 6498 67 96 221 108 879 5726 23 2534 2650 5059 3150 872 1546 6526 2074 5581 3200 6443 5207 1455 5216 5622 109 2157 3323 5783 56 3762 4116 25 74 6169 1 11 45 4501 6650 22 6586 42 4891 95 6504 6220 4358 3682 5051 21 3661 6512 6608 5006 46 97 6536 6522 4973 106 53 677 3784 38 2107 5601 284...
output:
29128 71145 45672 11426 66239 40270 44611 62536 73947 71844 50720 122128 122665 4396 16729 10356 49941 153505 103850 12231 55881 79773 79170 84419 17774 131120 81011 131159 14412 65782 8312 127990 118827 28074 12805 25699 15572 21981 3468 104118 164476 140475 120619 15501 139424 71171 88513 175629 4...
result:
Test #17:
score: 0
Time Limit Exceeded
input:
1000000 1000000 339706 51482 773204 314921 652924 724747 962292 955667 453210 745585 322194 279895 298423 488877 4886 93270 781046 874791 832792 999157 525479 758883 715236 767662 793020 89963 700913 886570 133268 888616 872182 356703 389171 931968 797835 349103 280162 430912 211317 173487 935739 55...
output:
340475 718456 103000 522858 639080 378129 575230 19656 218174 598026 104730 198728 397075 151218 132102 399118 425218 471790 537711 20481 300276 163808 48778 23539 415585 475206 61634 301880 67242 250724 172092 144349 141616 564879 37916 281561 454726 266357 120680 690310 341124 235437 222334 101145...
result:
Test #18:
score: 0
Time Limit Exceeded
input:
1000000 1000000 5924 66 11 21617 18383 33 22021 21252 32602 11762 102 15635 19155 17921 17781 6180 64 29027 100 12957 23796 24174 36 27445 9958 12 12778 31257 13873 31875 31854 6855 18736 28895 4727 8069 14914 13376 30634 11893 4316 9810 12613 19125 18712 10 25329 9579 4568 20807 15969 21444 61 2238...
output:
604616 358418 462567 94454 161244 350226 439351 96059 313768 604684 236684 78278 482608 199744 575758 93081 98209 548197 327297 235089 650607 492598 359348 90477 538694 35890 753183 255514 15595 82545 327871 79128 328488 335465 154534 56263 376500 633249 732520 400281 16628 336738 275363 152491 5292...
result:
Test #19:
score: 0
Time Limit Exceeded
input:
1000000 1000000 4911 31877 20155 18053 2309 19219 14047 3174 1572 31269 8791 9288 64 88 23830 27337 7798 18872 23785 3630 7060 4750 7156 32088 17 31362 23492 15773 22075 23416 10014 3325 2833 31381 4327 14864 28577 17304 25689 7151 6808 22066 14819 19879 8233 33255 5442 25475 5451 2195 20 10775 3151...
output:
498830 379106 39751 814177 204797 430509 140672 456342 589066 13732 85141 396177 433034 499813 71618 49619 548759 255759 659759 28732 200917 14339 138966 297994 672315 102759 284995 703047 286819 37957 219830 124051 556870 779679 683025 53935 196009 216506 560994 190307 502825 50933 390680 361885 20...
result:
Test #20:
score: 0
Time Limit Exceeded
input:
1000000 1000000 31 3260 17263 6463 75 30801 25644 20232 3043 67 10738 26620 28625 67 80 20107 11724 24348 7433 107 29792 13556 9437 20077 17224 45 8185 17267 25824 11468 26965 18 7872 9303 10598 31721 22996 30434 50 31 25744 24630 10169 19626 21 8201 14023 5292 30171 29678 5157 26288 31056 2094 1593...
output:
538377 651836 776498 403397 409979 10661 829754 301631 75914 675300 38198 778262 195536 155890 663426 9625 481562 357452 291760 421627 103015 114 252484 136378 644486 33038 186129 68682 111414 321458 103311 80134 160352 558463 710215 483854 473181 263472 330428 245861 374386 751141 589628 733210 321...