QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#251622 | #5165. 比赛 | IANYEYZ | 8 | 51ms | 75484kb | C++14 | 867b | 2023-11-14 21:58:56 | 2023-11-14 21:58:56 |
Judging History
answer
#include<iostream>
#include<vector>
#define int unsigned long long
using namespace std;
int a[100010],b[100010],t,n,q,l,r;
unsigned long long ans[3010][3010];
/* utility */
/* checker */
/* Solution */
signed main()
{
cin >> t >> n;
for(int i = 1;i <= n;i++) {
cin >> a[i];
}
for(int i = 1;i <= n;i++) {
cin >> b[i];
}
for(int i = 1;i <= n;i++) {
int mmax1 = 0,mmax2 = 0;
for(int j = i;j <= n;j++) {
mmax1 = max(mmax1,a[j]);
mmax2 = max(mmax2,b[j]);
ans[i][j] = ((unsigned long long)mmax1 * mmax2);
}
}
for(int i = 1;i <= n;i++) {
for(int j = n;j >= 1;j--) {
ans[i][j] = ans[i][j] + ans[i][j + 1];
}
}
cin >> q;
for(int i = 1;i <= q;i++) {
cin >> l >> r;
unsigned ans1 = 0;
for(int j = l;j <= r;j++) {
ans1 += ans[j][j] - ans[j][r + 1];
}
cout << ans1 << "\n";
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 4
Accepted
time: 1ms
memory: 5792kb
input:
1 30 12 28 21 20 26 9 6 10 27 1 16 19 30 5 2 25 4 3 29 17 7 14 8 22 24 13 23 11 18 15 12 29 4 25 24 18 2 1 26 22 10 14 13 9 21 8 16 11 7 23 27 17 20 5 30 15 6 19 3 28 30 1 30 2 24 1 24 1 23 4 28 6 30 2 23 4 29 5 28 4 29 3 28 4 28 5 26 4 30 1 25 21 26 27 30 8 15 2 23 1 30 17 27 4 20 3 23 18 23 3 4 7 ...
output:
336710 184007 203523 185997 225059 225153 167351 244869 206071 244869 244156 225059 169225 266125 224763 10602 3689 18312 167351 336710 39581 92768 148849 9978 1109 6894 106319 18113 50782 47053
result:
ok 30 lines
Test #2:
score: 4
Accepted
time: 0ms
memory: 3756kb
input:
2 30 10 17 6 8 11 25 3 12 18 27 19 24 4 2 22 15 26 21 13 29 1 28 5 9 7 20 23 30 16 14 2 22 19 20 5 14 1 25 30 24 27 18 21 4 23 15 8 12 13 29 9 28 6 10 3 16 17 11 26 7 30 1 30 3 24 2 28 2 27 4 25 5 27 4 28 4 30 7 28 7 28 1 30 8 30 8 29 1 27 1 25 9 28 4 27 13 25 7 30 1 4 1 6 2 23 15 28 6 13 5 26 4 22 ...
output:
342792 179327 273851 252521 180248 197746 235091 278681 180251 180251 342792 199838 181594 271572 231039 146648 215561 58601 218441 2698 6741 177789 68964 22922 180622 131720 318248 6692 57156 148723
result:
ok 30 lines
Test #3:
score: 0
Wrong Answer
time: 51ms
memory: 74252kb
input:
3 3000 353 828 1669 1982 2914 2076 2567 1457 1544 2684 2740 1321 2633 2048 2031 56 1523 1005 2808 1297 1259 2494 2270 1413 611 2423 1172 2329 1423 160 2510 944 1952 2500 1032 1072 2149 2883 2301 298 1783 791 1842 2505 147 2430 1098 1361 2044 118 643 2481 631 483 2477 2467 2551 1582 2330 866 835 716 ...
output:
1109813341 588741559 2480091146 2349269522 3357618677 3860369146 2572917876 2717351139 2657654226 162912108 1231302095 2145979040 2244710696 4162182445 1408677029 3648420547 2672875293 4239329409 1416913603 3702907881 1748010835 247402986 1616173331 2644385066 2111219578 2263588656 3499795989 414617...
result:
wrong answer 1st lines differ - expected: '40184823834717', found: '1109813341'
Test #4:
score: 0
Wrong Answer
time: 36ms
memory: 75140kb
input:
4 3000 2638 2598 731 140 1171 2511 1243 2680 1519 1460 2266 2053 2218 597 390 817 2038 1356 2174 2355 2783 42 262 2608 2157 19 703 631 1860 2840 573 1376 213 1058 1783 1188 1901 1785 1734 2141 2556 2376 906 1327 1464 2405 1339 2048 2005 110 1509 2551 431 2716 2652 722 502 1477 686 2319 891 80 1888 4...
output:
867602096 2843181567 3114707868 2724284448 1057603666 3570014999 304477686 3670978657 1715538765 2828662379 1977546072 1877269911 2093169900 1168087717 760043424 2666936723 1945400030 847151326 3510073373 1753133625 4221422229 2045550973 3367823849 3872582812 610248099 2274451846 3676164568 37054922...
result:
wrong answer 1st lines differ - expected: '40206056459952', found: '867602096'
Test #5:
score: 0
Wrong Answer
time: 43ms
memory: 75484kb
input:
5 3000 2249 537 2892 2283 2306 2418 31 1660 766 2489 2604 705 274 2387 179 2884 2367 1218 194 2341 1800 2722 2055 1390 2383 691 2560 2590 1612 2061 1830 2375 554 1301 401 450 733 2116 1210 2649 84 1657 1302 2028 1200 1347 793 929 2834 1600 1512 1102 490 649 1329 2403 1246 2312 1363 1736 2045 299 249...
output:
1628397475 1874725330 1751934838 1424459447 1505986388 1974346508 1059144430 1415247163 818381849 4126960015 153004551 3882898584 3883058807 221364733 2178616638 3712633408 1131954967 1683733177 2211268361 2317021444 884169747 476664653 934684329 3156745877 3095433898 3088506996 3805387501 254127544...
result:
wrong answer 1st lines differ - expected: '40215407189923', found: '1628397475'
Test #6:
score: 0
Runtime Error
input:
6 100000 75396 38259 70632 44693 79241 97717 47646 85325 83810 92620 10842 2833 69920 53424 11573 42594 83445 5481 16123 10436 81601 67126 21529 83632 91675 53146 93935 75478 26177 10079 61996 62220 65571 17854 62571 44120 12071 28594 9282 43761 93433 50961 16593 95861 25192 62665 20974 92691 27730 ...
output:
result:
Test #7:
score: 0
Runtime Error
input:
7 100000 63014 56265 32171 20204 73218 62 14769 68831 53214 29740 74162 95845 11373 74008 25172 29026 20301 54740 30487 83999 11075 78571 60955 20839 65241 12436 47345 41877 82265 71138 76247 70103 58369 34126 19769 85143 52047 81783 28431 69356 73486 7452 86080 81571 65219 5041 92975 32553 66188 85...
output:
result:
Test #8:
score: 0
Runtime Error
input:
8 250000 102524 204126 191550 136652 234896 111850 90965 123593 106274 56675 82246 19895 57397 55004 46130 155550 39785 60103 122552 214968 216455 48719 166072 172777 104767 92024 32452 230050 103268 158821 178060 45135 204816 161747 91265 241770 97501 21273 203007 171576 242557 36395 161246 236301 ...
output:
result:
Test #9:
score: 0
Runtime Error
input:
9 250000 200098 97174 28170 173369 98549 34871 116482 220351 141539 159688 93550 139417 45870 191337 186976 147334 195549 152697 174924 168723 223082 182413 225141 21840 44011 60626 230775 79423 153938 5518 29510 41843 2318 10396 122588 34595 66572 245685 47998 67755 240326 101564 5965 202014 26201 ...
output:
result:
Test #10:
score: 0
Runtime Error
input:
10 100000 99999 99997 38376 6647 99995 45264 99994 60797 3686 19252 18126 99993 60719 5628 99992 32773 99990 99989 50339 47441 6259 99988 40227 39408 4332 54868 4905 99987 28891 99986 56608 3960 49232 52515 48642 99985 99983 38232 99982 42651 99981 15289 52368 47437 47335 14612 35407 7505 99980 1777...
output:
result:
Test #11:
score: 0
Runtime Error
input:
11 100000 100000 30591 99999 99998 99997 6657 99996 99994 99992 38864 99991 20670 99990 99988 99987 99985 39155 99983 99982 99978 99976 27117 99974 99973 99967 24075 37813 99961 39325 30605 99964 99963 99962 99965 30090 99955 5617 18135 35997 99957 99956 28441 21161 5823 99958 99951 31145 99949 9994...
output:
result:
Test #12:
score: 0
Runtime Error
input:
12 250000 61524 87207 90471 27670 249999 16574 249998 146951 37265 36283 109285 23307 82928 249997 91608 78510 37152 149901 84119 96035 249994 249993 153324 36882 77439 113753 148205 249992 167295 124778 249990 169147 111261 126598 69467 249983 249989 30595 56533 58700 84977 249987 249984 32849 8844...
output:
result:
Test #13:
score: 0
Runtime Error
input:
13 250000 249999 249991 20376 249967 249987 249984 91555 249980 119971 249975 4184 82372 249974 249972 249968 121786 112458 62201 249988 249962 249961 113867 107713 120838 64384 22539 249959 114100 249957 55583 86376 120039 249955 249952 15133 249936 249934 249928 14071 86733 249926 31954 249917 965...
output:
result:
Test #14:
score: 0
Runtime Error
input:
14 100000 3597 5516 55551 37736 24211 37914 21390 22526 46215 55934 32264 65310 42575 65276 24672 44887 19860 76191 20150 16092 13668 67517 49084 56403 12945 40511 43649 54874 58111 16947 79097 87926 41053 81714 85374 26502 49945 78788 4803 80183 46427 2335 68454 58827 34567 84916 54004 32408 38036 ...
output:
result:
Test #15:
score: 0
Runtime Error
input:
15 100000 57947 32527 16708 9265 74780 96120 10235 79718 61290 9952 70460 34316 29410 32436 61691 94001 53555 61234 13140 32757 73723 32566 66354 71055 33746 66066 43476 59950 84762 44443 13470 79853 99700 10649 97877 73182 60586 86844 88176 7865 52949 56433 72723 58388 80743 52574 35199 95237 34911...
output:
result:
Test #16:
score: 0
Runtime Error
input:
16 250000 66306 188910 58319 44602 94461 248619 191701 9283 84850 155848 129558 21149 14162 191976 24385 92838 106196 74117 86536 186052 195455 9505 57069 111387 232179 68871 71099 83805 245081 49405 4968 22277 102051 219152 53152 71844 85630 75109 149087 85840 203663 157740 17189 224588 125747 1654...
output:
result:
Test #17:
score: 0
Runtime Error
input:
17 250000 214518 7109 165693 60996 99727 33543 225083 68598 41778 4151 81497 40289 177818 156013 224688 237064 79616 21242 230963 161523 96814 51020 61668 19841 180565 177619 169253 1584 71948 103452 146421 146694 19330 30181 232433 161668 135488 88316 191971 24533 230674 125996 58536 131117 222030 ...
output:
result:
Test #18:
score: 0
Runtime Error
input:
18 100000 199 11245 59248 15250 95721 77198 12068 47226 70219 94612 40882 78125 56325 81706 99564 57757 40981 16735 6520 37254 22399 45242 56303 18639 90538 5749 67746 10561 83841 8002 97391 44193 82633 47690 22491 88835 47085 11531 52728 90114 66975 84612 90065 10969 4360 66237 89606 281 78020 6408...
output:
result:
Test #19:
score: 0
Runtime Error
input:
19 100000 34498 55141 40963 75807 81840 89426 43863 32781 39782 31733 91313 97434 93531 80424 17034 16579 93540 26418 37633 70011 48786 19831 45883 38094 92295 72555 46747 21368 77539 18609 40907 88241 53467 7765 25009 41052 5111 20060 5059 51826 5359 71155 74408 47512 86754 66199 91733 11292 92220 ...
output:
result:
Test #20:
score: 0
Runtime Error
input:
20 250000 142345 136958 147947 150195 175778 238652 55360 166158 240487 70312 222146 26065 190856 62531 107895 54077 134731 76929 247840 99416 42360 132793 110469 176374 237332 180573 34058 148110 112862 150992 68053 6351 21165 227763 100676 238525 249762 94625 9877 57640 210186 121501 233338 103138...
output:
result:
Test #21:
score: 0
Runtime Error
input:
21 250000 159644 118111 87979 83677 241819 36594 90595 96968 114358 249598 220083 174210 179881 66939 78773 174346 232433 135387 133117 154375 202090 27468 211108 24017 129381 118539 138809 178525 234827 1082 189139 89875 205732 122496 60062 246324 87972 213698 81399 159352 109340 173047 119539 1451...
output:
result:
Test #22:
score: 0
Runtime Error
input:
22 100000 99987 99992 99993 99990 99988 99991 99986 99982 99980 22717 3929 16263 29103 99979 99978 99977 99976 10865 99974 16993 99961 32111 99960 99957 99956 99949 26884 99947 23452 99946 22242 99945 99944 24237 99943 99938 99937 9438 12536 99935 99934 99930 99926 99922 99924 33917 3063 99923 99925...
output:
result:
Test #23:
score: 0
Runtime Error
input:
23 100000 22584 33702 100000 37252 25122 17398 99998 99997 21290 99994 99990 99989 22335 22740 9312 99986 33821 99985 99984 99983 99979 99975 27331 99974 99973 13708 31617 99972 31130 13202 99971 99968 99967 3499 15101 99965 99964 99963 99962 36857 99960 37915 5196 10357 28557 14304 38089 27830 9995...
output:
result:
Test #24:
score: 0
Runtime Error
input:
24 250000 25471 61705 74365 249999 38625 85441 106054 12840 24109 3680 126059 249997 249995 249990 249989 249985 126496 119298 249984 19970 249983 57482 249982 249979 249978 59295 115702 17 80704 26932 249977 127802 45793 249976 249975 59578 249974 29119 48458 249973 18429 126811 126616 41549 249972...
output:
result:
Test #25:
score: 0
Runtime Error
input:
25 250000 250000 16831 249999 249998 23668 73080 81716 58206 249997 48474 249995 249993 36919 7843 249992 249989 249988 1992 50732 1225 51301 249987 249986 249983 249982 17515 249980 11033 28231 92583 249979 45096 59146 249978 249977 65779 249976 6789 249975 249974 249973 249972 19209 60855 47949 24...