QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#448808 | #7771. 不是这一道据数构结题 | kkkgjyismine4 | 0 | 560ms | 60792kb | C++23 | 718b | 2024-06-20 08:48:22 | 2024-06-20 08:48:23 |
Judging History
answer
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
int a[1000005],n,q;
int stk[1000005],tail,c[1000005],Ans[1000005],ql[1000005];
vector<int>vec[1000050];
void add(int p,int o){
for(int i=p;i<=n;i+=(i&-i))c[i]+=o;
}
int qry(int p){
int ans=0;
for(int i=p;i;i&=(i-1))ans+=c[i];
return ans;
}
int main(){
scanf("%d%d",&n,&q);
for(int i=1;i<=n;++i)scanf("%d",&a[i]);
for(int i=1;i<=q;++i){
int x;scanf("%d%d",&ql[i],&x);
vec[x].push_back(i);
}
for(int i=1;i<=n;++i){
while(tail&&a[stk[tail]]>=a[i])--tail;
add(stk[tail]+1,1),add(i+1,-1),stk[++tail]=i;
for(auto v:vec[i])Ans[v]=i-ql[v]+1-qry(ql[v]);
}
for(int i=1;i<=q;++i)printf("%d\n",Ans[i]);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3872kb
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:
62 88 14 7 9 1 52 19 0 9 44 7 3 12 5 32 9 83 2 51 32 0 42 62 43 18 2 27 39 22 47 49 29 17 31 34 33 5 52 37 15 1 8 3 37 83 43 6 1 32 15 77 13 56 16 56 45 7 65 36 12 75 46 50 10 28 76 6 4 63 33 18 4 33 26 34 40 2 7 15 12 14 33 56 60 44 27 9 7 16 20 60 45 0 35 44 1 22 5 0
result:
wrong answer 1st numbers differ - expected: '65', found: '62'
Test #2:
score: 0
Wrong Answer
time: 2ms
memory: 3808kb
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:
34 24 51 26 38 28 0 14 24 33 7 38 34 6 47 24 48 26 33 52 10 2 31 11 52 21 47 57 10 58 48 24 5 26 23 2 24 47 13 13 55 27 21 49 49 4 4 50 8 25 9 10 26 23 26 15 26 50 26 17 4 43 40 1 43 31 56 51 25 22 44 12 19 27 16 4 8 1 2 35 1 13 65 41 21 7 13 14 58 6 11 25 45 41 31 44 47 24 6 53
result:
wrong answer 1st numbers differ - expected: '35', found: '34'
Test #3:
score: 0
Wrong Answer
time: 3ms
memory: 4136kb
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:
1454 903 1094 245 2566 9 1172 322 1704 2217 620 42 1346 1446 631 2738 1014 821 628 601 984 1100 1125 1182 145 2253 971 978 629 1095 682 2311 1881 157 1150 1105 1671 780 722 2037 472 329 977 878 2078 5 1254 975 609 1044 1372 1498 1812 1153 1166 594 646 292 19 168 2600 1650 1969 1656 1034 1128 153 476...
result:
wrong answer 1st numbers differ - expected: '1464', found: '1454'
Test #4:
score: 0
Wrong Answer
time: 2ms
memory: 3960kb
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:
1072 879 1826 55 329 98 2417 574 1200 1583 476 1115 2738 1540 1241 55 1396 1039 820 265 454 859 243 1294 1817 275 220 1042 2440 1172 2454 418 796 72 364 844 871 1004 414 985 718 444 340 2523 378 1156 2683 252 23 206 1694 795 42 1075 333 2 3 112 1642 1869 683 733 68 400 2422 774 461 1286 2051 749 108...
result:
wrong answer 1st numbers differ - expected: '1079', found: '1072'
Test #5:
score: 0
Wrong Answer
time: 3ms
memory: 4044kb
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:
704 470 1001 1838 192 1479 1271 2297 82 1732 2233 296 256 852 1431 2479 1692 864 1633 330 1065 724 370 25 857 1506 1473 232 365 1476 88 773 172 163 950 1528 805 1213 134 1463 571 547 438 102 24 2104 1456 1248 1261 259 9 223 581 1433 1790 1895 170 952 1410 1292 568 501 1602 975 435 1560 648 2447 113 ...
result:
wrong answer 1st numbers differ - expected: '708', found: '704'
Test #6:
score: 0
Wrong Answer
time: 3ms
memory: 4140kb
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:
464 713 422 444 1165 1797 578 768 623 661 1069 875 2816 511 1176 290 2016 378 1916 1468 503 2125 465 1292 399 1175 350 487 401 917 1250 22 30 1683 288 1724 831 556 2519 214 856 982 700 712 3 2270 260 58 163 653 882 27 1046 2192 649 1206 427 1829 559 2185 889 1417 115 1896 1689 531 13 2134 2548 1375 ...
result:
wrong answer 1st numbers differ - expected: '467', found: '464'
Test #7:
score: 0
Wrong Answer
time: 3ms
memory: 4068kb
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:
1483 784 351 119 295 1002 776 337 651 370 1863 529 299 1475 2297 207 1094 1058 1361 891 1229 1826 1683 61 629 178 911 1711 738 720 297 342 1628 44 61 101 1679 1261 1954 903 1337 350 174 157 119 1846 1776 1221 129 359 761 1494 1629 329 216 53 1120 1632 844 1328 460 262 923 250 915 2225 1762 218 96 10...
result:
wrong answer 1st numbers differ - expected: '1486', found: '1483'
Test #8:
score: 0
Wrong Answer
time: 3ms
memory: 4008kb
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:
1575 101 34 1421 1134 1134 5 159 186 1874 484 1142 1414 1519 1 1444 289 619 739 655 2320 526 503 50 336 14 971 275 1041 13 46 1094 629 338 532 2096 628 232 104 79 719 720 1222 491 1630 1412 1777 589 209 153 108 2006 675 2382 1467 1974 719 547 1511 259 62 827 744 2591 824 1253 335 1948 2107 311 2142 ...
result:
wrong answer 1st numbers differ - expected: '1585', found: '1575'
Test #9:
score: 0
Wrong Answer
time: 0ms
memory: 4472kb
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:
2311 3594 3089 8529 190 955 790 3049 2029 2017 1535 2185 2824 762 5554 4423 1296 2059 252 3471 6748 2221 3438 79 8988 3652 6005 6239 590 6580 3461 5984 780 2668 4608 3812 6494 5401 5628 3381 8476 3394 4100 757 3375 2552 1634 447 3100 2310 6116 1225 6208 120 319 1888 2076 760 1639 951 6462 4070 538 2...
result:
wrong answer 1st numbers differ - expected: '2317', found: '2311'
Test #10:
score: 0
Wrong Answer
time: 5ms
memory: 4368kb
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:
2263 2645 436 7134 3422 85 4842 1479 1879 8432 6847 8563 4631 786 3686 244 3897 1321 234 5379 5852 7992 862 930 3318 9294 3505 5276 2640 4539 248 3219 177 7164 7696 2802 2137 335 6977 2385 4365 5376 3226 3579 5476 4811 1356 1049 2116 2858 1450 1480 1417 2596 1070 5956 2387 3952 3387 34 207 858 2758 ...
result:
wrong answer 1st numbers differ - expected: '2271', found: '2263'
Test #11:
score: 0
Wrong Answer
time: 5ms
memory: 4540kb
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:
3528 3482 6379 272 972 2110 803 3959 2802 7 247 1424 9057 2825 5785 4711 5133 4187 1814 2029 398 5446 6134 2808 4758 3118 22 2005 92 825 4161 4449 307 3856 8997 7819 2106 1763 7984 648 3274 1353 8567 1734 4741 5964 129 5237 3415 857 6262 842 1841 8024 1736 1698 1447 3912 4330 968 1333 3137 4963 4544...
result:
wrong answer 1st numbers differ - expected: '3540', found: '3528'
Test #12:
score: 0
Wrong Answer
time: 6ms
memory: 4364kb
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:
1088 1583 3512 1024 6203 8316 2856 5730 1089 2340 635 2482 465 1123 3817 6085 618 2968 3752 391 3681 3740 4696 6412 4517 8129 6117 410 1493 1249 1158 5088 390 4415 1595 6343 4452 3970 4613 5326 3833 1085 181 4338 9152 1897 9166 205 510 2401 2278 9303 2462 3195 1893 2251 5592 1243 1523 555 7391 2490 ...
result:
wrong answer 1st numbers differ - expected: '1097', found: '1088'
Test #13:
score: 0
Wrong Answer
time: 87ms
memory: 15292kb
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:
75079 92561 57617 28632 48913 56548 82961 66679 28311 166419 477 38940 118465 122064 50216 3053 79225 79196 13569 72980 45698 144199 30486 58336 162772 75571 74019 10823 4336 9715 140836 20892 52943 88383 63110 19333 118663 165359 112243 89808 57436 88376 122806 55224 102422 128208 134642 2804 13352...
result:
wrong answer 1st numbers differ - expected: '75089', found: '75079'
Test #14:
score: 0
Wrong Answer
time: 84ms
memory: 15256kb
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:
68591 42010 31636 94117 14372 59426 124996 172529 42643 96591 17549 140896 1158 174112 6106 9889 118421 85265 52879 20150 20147 9450 113412 187693 23790 82039 38162 84951 116333 22769 56578 55133 59215 34388 101140 44228 49094 34682 18432 3673 47372 13853 125993 60021 56180 7161 117288 132365 53650 ...
result:
wrong answer 1st numbers differ - expected: '68599', found: '68591'
Test #15:
score: 0
Wrong Answer
time: 99ms
memory: 15196kb
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:
40289 781 17306 4336 89973 20169 75785 134654 58687 21687 83914 48389 54804 119869 40553 150246 124744 14785 160797 97949 47884 107993 71578 16817 48001 10207 57937 179392 11846 2872 44392 49556 62151 25910 101980 528 23710 7899 13849 66708 69128 130904 4070 25228 7960 57614 145618 93849 82015 24642...
result:
wrong answer 1st numbers differ - expected: '40298', found: '40289'
Test #16:
score: 0
Wrong Answer
time: 86ms
memory: 15232kb
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:
10105 12789 38725 16164 198011 30966 25809 58758 27221 68593 7171 19903 76351 116018 80136 179180 101775 7810 7869 5174 87623 100470 59647 68154 157969 33919 27882 170213 35506 27219 51563 72315 61587 23411 94029 95341 53038 39920 164677 5884 52202 90660 125163 1893 74143 9311 139071 32559 51262 830...
result:
wrong answer 1st numbers differ - expected: '10114', found: '10105'
Test #17:
score: 0
Wrong Answer
time: 542ms
memory: 60792kb
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:
401381 115083 693934 405913 741541 92618 200482 82744 151382 227993 301554 510446 34236 128586 315008 504002 716088 46098 145046 544849 118904 145548 413031 596745 100847 50885 883793 180188 311835 417202 651475 188579 70431 122234 276152 104236 150057 733177 335323 609185 51876 907236 408505 507194...
result:
wrong answer 1st numbers differ - expected: '401390', found: '401381'
Test #18:
score: 0
Wrong Answer
time: 560ms
memory: 60756kb
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:
601765 87968 543617 148199 122237 85809 8151 181372 13898 194230 213320 139424 173141 498605 268376 595798 407075 147629 107018 14133 345519 160956 75770 611033 108833 263592 11059 517121 545489 707794 287944 26596 639816 4454 247011 426976 139143 21843 357752 297204 695750 93724 571697 513892 14231...
result:
wrong answer 1st numbers differ - expected: '601769', found: '601765'
Test #19:
score: 0
Wrong Answer
time: 551ms
memory: 60688kb
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:
149899 626043 592261 104645 180032 665722 132491 790566 318316 111434 27216 177439 318886 202104 522908 250067 266046 306154 869689 340274 43423 690058 490512 148533 558720 328403 440514 667761 674155 327397 120936 251382 476725 316585 798057 255027 307445 809181 159179 146499 692613 450085 677085 2...
result:
wrong answer 1st numbers differ - expected: '149909', found: '149899'
Test #20:
score: 0
Wrong Answer
time: 535ms
memory: 60716kb
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:
127354 622399 88960 350097 62055 220803 468806 369341 696620 227024 194492 770534 698544 327846 58026 172047 19258 81492 11197 448619 621720 574028 298966 855971 21112 532359 932549 240256 256796 655249 96657 280050 640358 191900 328361 350239 422632 246023 781627 152838 111838 532524 705761 191455 ...
result:
wrong answer 1st numbers differ - expected: '127368', found: '127354'