QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#825394 | #9773. Infinite Loop | ucup-team3691# | AC ✓ | 123ms | 17380kb | C++20 | 2.1kb | 2024-12-21 18:57:15 | 2024-12-21 18:57:15 |
Judging History
answer
#include <iostream>
#include <map>
#include <queue>
#include <queue>
using namespace std;
long long x[200005];
long long y[200005];
long long rasp1[200005];
long long rasp2[200005];
long long rasp3[200005];
queue<pair<long long,long long> >qu;
priority_queue<pair<long long,long long> >pq;
void afis(long long timp,long long x)
{
cout<<(timp-1)/x+1<<" "<<(timp-1)%x+1<<'\n';
}
signed main()
{
long long i,j,k,l,n,a,b,q,timp;
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>n>>k>>q;
for(i=1; i<=n; i++)
{
cin>>x[i]>>y[i];
pq.push({-x[i],i});
pq.push({-k-x[i],i});
pq.push({-2*k-x[i],i});
}
while(pq.size())
{
auto curr=pq.top();
pq.pop();
if(curr.second>0)
{
qu.push({curr.first,curr.second});
if(qu.size()==1)
{
pq.push({curr.first,0});
}
}
else
{
if(qu.size())
{
timp=min(timp,curr.first);
curr=qu.front();
if(rasp1[curr.second]==0)
{
rasp1[curr.second]=-1*(timp-y[curr.second]+1);
pq.push({timp-y[curr.second],0});
timp=timp-y[curr.second];
}
else if(rasp2[curr.second]==0)
{
rasp2[curr.second]=-1*(timp-y[curr.second]+1);
pq.push({timp-y[curr.second],0});
timp=timp-y[curr.second];
}
else
{
rasp3[curr.second]=-1*(timp-y[curr.second]+1);
pq.push({timp-y[curr.second],0});
timp=timp-y[curr.second];
}
qu.pop();
}
}
}
for(i=1; i<=q; i++)
{
cin>>a>>b;
if(a==1)
{
afis(rasp1[b],k);
}
else
{
afis(rasp2[b]+(a-2)*(rasp3[b]-rasp2[b]),k);
}
// cout<<'\n';
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 7840kb
input:
2 5 6 1 1 4 3 1 1 1 2 2 1 2 2 3 1 3 2
output:
1 1 2 1 2 2 3 1 3 2 4 1
result:
ok 12 numbers
Test #2:
score: 0
Accepted
time: 1ms
memory: 5608kb
input:
3 10 5 2 4 3 1 10 7 2 2 7 1 4 3 5 2 28 3
output:
3 1 8 10 6 2 6 7 34 10
result:
ok 10 numbers
Test #3:
score: 0
Accepted
time: 0ms
memory: 7716kb
input:
2 5 6 1 1 4 4 1 1 1 2 2 1 2 2 3 1 3 2
output:
1 1 2 2 2 3 3 2 3 3 4 2
result:
ok 12 numbers
Test #4:
score: 0
Accepted
time: 100ms
memory: 14896kb
input:
100000 100000000 100000 10 100000000 20 100000000 30 100000000 40 100000000 50 100000000 60 100000000 70 100000000 80 100000000 90 100000000 100 100000000 110 100000000 120 100000000 130 100000000 140 100000000 150 100000000 160 100000000 170 100000000 180 100000000 190 100000000 200 100000000 210 1...
output:
36129307020 9 26234983914 9 41309926070 9 46251938728 9 37943897764 9 18465580631 9 24057802725 9 46065927576 9 8562863275 9 19671679431 9 10995435094 9 45479963939 9 15142996651 9 37343630475 9 4867591081 9 26424135243 9 22968233395 9 33168452543 9 184417 9 5887110217 9 7946303466 9 12476713941 9 3...
result:
ok 200000 numbers
Test #5:
score: 0
Accepted
time: 105ms
memory: 15588kb
input:
100000 100000000 100000 50000010 767 50000020 720 50000030 1043 50000040 383 50000050 457 50000060 123 50000070 255 50000080 478 50000090 422 50000100 1046 50000110 329 50000120 803 50000130 862 50000140 857 50000150 392 50000160 1022 50000170 572 50000180 324 50000190 190 50000200 1081 50000210 316...
output:
189472 75188938 6062 60058533 187817 72799176 175645 9027868 273552 97128926 404444 85017994 432526 76147901 73731 63080602 386838 65185635 441819 56238188 167074 56280428 16382 96188106 336596 76929886 89817 62078424 102256 70594211 297143 98092920 348605 51225880 100512 51308534 50244 4300467 3193...
result:
ok 200000 numbers
Test #6:
score: 0
Accepted
time: 107ms
memory: 15684kb
input:
100000 100000000 100000 50000127 1000 50000215 1000 50000339 1000 50000430 1000 50000503 1000 50000618 1000 50000719 1000 50000828 1000 50000935 1000 50001042 1000 50001142 1000 50001227 1000 50001322 1000 50001427 1000 50001537 1000 50001614 1000 50001727 1000 50001846 1000 50001939 1000 50002033 1...
output:
247819 10560126 52586 74747126 165285 57999126 76095 28446126 311189 36444126 113026 35236126 468833 49208126 461379 58489126 461343 73204126 273160 15625126 76708 48154126 169963 88476126 361116 83206126 211711 74167126 488492 62905126 223889 88854126 488244 38684126 195751 97947126 481099 86969126...
result:
ok 200000 numbers
Test #7:
score: 0
Accepted
time: 104ms
memory: 15760kb
input:
100000 100000000 100000 1000 1000 2000 1000 3000 1000 4000 1000 5000 1000 6000 1000 7000 1000 8000 1000 9000 1000 10000 1000 11000 1000 12000 1000 13000 1000 14000 1000 15000 1000 16000 1000 17000 1000 18000 1000 19000 1000 20000 1000 21000 1000 22000 1000 23000 1000 24000 1000 25000 1000 26000 1000...
output:
460111 57209999 21009 21670999 437826 72874999 25876 2384999 46024 40611999 185212 4077999 229465 73014999 142272 56857999 80327 8791999 423193 11199999 339075 2844999 362977 13634999 307570 13517999 286659 3388999 311342 1916999 435814 55677999 430055 12233999 120770 28293999 234566 34949999 479551...
result:
ok 200000 numbers
Test #8:
score: 0
Accepted
time: 118ms
memory: 14908kb
input:
100000 100000000 100000 1000 936 2000 409 3000 53 4000 248 5000 1203 6000 94 7000 848 8000 1144 9000 1043 10000 287 11000 777 12000 1534 13000 1056 14000 1137 15000 574 16000 10 17000 1215 18000 715 19000 179 20000 932 21000 669 22000 1356 23000 573 24000 959 25000 298 26000 1228 27000 669 28000 729...
output:
24949 68723513 215451 69638185 479376 85436408 190908 93047593 139856 76967911 102561 98297832 93203 93564860 68516 45328252 197985 13674907 344751 77304687 16089 96249325 345704 84324745 458489 47046284 185536 32637058 40604 99089672 227059 55437284 420854 71183303 41872 92085780 373775 93531617 23...
result:
ok 200000 numbers
Test #9:
score: 0
Accepted
time: 29ms
memory: 7996kb
input:
10000 100000000 100000 900 713 1800 223 2700 1094 3600 196 4500 1558 5400 404 6300 887 7200 243 8100 644 9000 1101 9900 226 10800 1143 11700 1127 12600 1164 13500 606 14400 1077 15300 1447 16200 624 17100 37 18000 307 18900 287 19800 270 20700 838 21600 843 22500 832 23400 1094 24300 1544 25200 1084...
output:
342325 5005213 492736 6846869 203144 2364263 169794 4932294 34067 1178407 152519 2720858 52183 1186511 24402 4764079 16481 4796687 122053 3001912 230138 5386494 90532 6802134 52065 7327307 310211 4404337 80568 6013642 164449 2085698 97470 8163445 14407 731359 293801 3161534 248299 7717119 470525 614...
result:
ok 200000 numbers
Test #10:
score: 0
Accepted
time: 88ms
memory: 15464kb
input:
100000 100000000 10000 900 352 1800 1583 2700 1510 3600 498 4500 323 5400 481 6300 1055 7200 607 8100 639 9000 1028 9900 1597 10800 1234 11700 561 12600 995 13500 1517 14400 874 15300 64 16200 945 17100 334 18000 724 18900 1412 19800 1518 20700 1547 21600 703 22500 885 23400 903 24300 878 25200 1522...
output:
465717 25814183 1 86787353 467932 43092171 448846 30084198 326886 49920491 379070 10642760 376682 29960236 237841 9580781 236223 49518398 122012 15875255 2 83558247 435290 70154396 1 42911768 2 72310155 345568 17814 1 75982345 1 54868058 102518 62080995 1 89246972 374089 23894306 100423 60506274 191...
result:
ok 20000 numbers
Test #11:
score: 0
Accepted
time: 111ms
memory: 14560kb
input:
100000 100000000 100000 800 847 1600 195 2400 1300 3200 1028 4000 1192 4800 16 5600 615 6400 585 7200 191 8000 48 8800 1162 9600 1050 10400 80 11200 1123 12000 284 12800 1164 13600 1419 14400 620 15200 659 16000 1005 16800 1075 17600 1192 18400 463 19200 76 20000 19 20800 1530 21600 481 22400 742 23...
output:
204887 67255148 95183 77304119 383830 20747526 410928 34598110 462359 63469256 3 55084751 161372 5088170 272840 58382175 5 44447306 45879 70967820 5 1008981 211683 38551565 438155 13052639 123320 19116721 212845 64548467 254537 34972975 5 33850962 4 59467930 2 57050976 52968 9227486 496578 46313523 ...
result:
ok 200000 numbers
Test #12:
score: 0
Accepted
time: 113ms
memory: 17380kb
input:
100000 100000000 100000 766 2231 2997 56 3053 23 3076 86 3162 555 3717 1600 5317 216 5533 1541 7074 1128 8202 666 8868 313 9181 193 9374 322 9696 344 10040 285 10325 341 10666 949 11615 668 12283 753 13036 65 13101 410 13511 1682 15193 1582 16775 3870 20645 424 21069 1929 22998 31 23029 869 23898 19...
output:
355433 87191325 1 360573 428482 26508129 179899 80098022 197532 25598874 40324 4036975 180410 78560313 444168 9524126 403767 1266702 430300 84546392 497042 22784570 106155 54286478 199409 24926734 214000 82874844 15844 93079009 228881 8255186 4 3436365 418648 26631410 3436 41601227 64600 774952 2529...
result:
ok 200000 numbers
Test #13:
score: 0
Accepted
time: 108ms
memory: 14352kb
input:
100000 100000000 100000 125 217 342 99 441 172 613 1275 1888 519 2407 2477 4884 990 5874 499 6373 1034 7407 1104 8511 2279 10790 854 11644 1664 13308 294 13602 725 14327 783 15110 294 15404 237 15641 919 16560 924 17484 1150 18634 1865 20499 665 21164 743 21907 2387 24294 848 25142 873 26015 697 267...
output:
389517 77816859 150621 34164350 105698 78583452 465986 79983478 105491 97310540 265912 96964486 72820 47082455 67934 15953357 134245 24206085 210882 49799736 19677 90589472 391952 53358467 494580 86951814 210634 17481556 474901 31967379 147835 77538580 96053 82875672 8938 83352955 112972 57256667 32...
result:
ok 200000 numbers
Test #14:
score: 0
Accepted
time: 105ms
memory: 16424kb
input:
100000 100000000 100000 242 423 665 867 1532 1833 3365 755 4120 1263 5383 1777 7160 14 7174 1411 8585 347 8932 60 8992 3097 12089 1607 13696 84 13780 1425 15205 546 15751 98 15849 1772 17621 621 18242 750 18992 384 19376 711 20087 1366 21453 427 21880 2452 24332 557 24889 219 25108 79 25187 626 2581...
output:
375533 56451906 132939 50131079 407484 68346992 163390 90805281 316505 66769131 79263 15890106 424090 44142087 446074 79879495 277926 32270339 491526 30365478 129951 22485530 461082 95155945 180261 29553980 5560 83412977 48362 27021417 31965 92154751 5 47071782 182004 86242167 208585 33610593 4 2109...
result:
ok 200000 numbers
Test #15:
score: 0
Accepted
time: 116ms
memory: 16668kb
input:
100000 100000000 100000 615 92 707 671 1378 1008 2386 2957 5343 271 5614 190 5804 1087 6891 79 6970 854 7824 203 8027 296 8323 848 9171 1157 10328 876 11204 18 11222 257 11479 1993 13472 276 13748 23 13771 1398 15169 2391 17560 305 17865 3425 21290 4065 25355 144 25499 696 26195 1842 28037 153 28190...
output:
5 11287278 402446 79728766 329171 66309028 492146 64242276 191183 73659032 82371 2408965 434067 26147456 107304 52943606 224248 13019296 395059 94427617 2086 71440201 489192 33854322 183108 85763666 428427 91613976 153426 6800674 147621 15294466 444691 54076771 334647 18072890 463108 45242409 183227...
result:
ok 200000 numbers
Test #16:
score: 0
Accepted
time: 117ms
memory: 15748kb
input:
100000 100000000 100000 1619 1174 2793 71 2864 1006 3870 763 4633 475 5108 686 5794 1722 7516 796 8312 632 8944 1029 9973 606 10579 1687 12266 2019 14285 574 14859 983 15842 264 16106 120 16226 509 16735 393 17128 430 17558 1894 19452 1371 20823 427 21250 2556 23806 156 23962 2305 26267 2128 28395 2...
output:
339537 79321377 3 84410144 397663 93795386 380876 3873444 392264 45444366 339243 73512086 163584 31806794 125356 57898875 124608 6499687 181018 31624207 427736 54928630 261688 34347862 330103 141764 360155 10943522 391834 5543178 240731 700757 341232 48350324 45203 34530447 32751 2315420 494132 4211...
result:
ok 200000 numbers
Test #17:
score: 0
Accepted
time: 123ms
memory: 16248kb
input:
100000 100000000 100000 443 1676 2120 815 2936 237 3174 134 3309 469 3779 619 4399 100 4500 1 4502 1158 5661 299 5961 335 6297 277 6575 226 6802 830 7633 956 8590 2393 10984 1289 12274 4410 16685 105 16791 583 17375 343 17719 266 17986 395 18382 22 18405 810 19216 2382 21599 3645 25245 1883 27129 19...
output:
260258 43173645 173084 86574757 107987 48157443 25557 87465774 63448 97825043 144230 31205988 367613 31223786 332859 6477710 12899 45265404 492677 83729592 53459 94040108 9325 42056145 473820 64037415 6 86673225 244147 1780812 97057 90647125 446558 57104272 308979 99594423 447669 61708657 32459 2200...
result:
ok 200000 numbers
Test #18:
score: 0
Accepted
time: 118ms
memory: 16116kb
input:
100000 100000000 100000 1011 1928 2940 1469 4410 1526 5937 42 5980 1664 7644 143 7787 753 8541 1007 9548 2196 11744 1487 13232 1424 14658 3084 17742 90 17833 401 18235 48 18283 4457 22740 288 23028 367 23395 1364 24759 581 25340 565 25905 321 26228 1148 27377 864 28242 139 28381 593 28976 712 29689 ...
output:
199397 37417401 228019 95788380 438007 20114028 301064 24241883 293596 23689125 40746 49334140 6 12163586 3 88493226 33937 12453685 310114 21254004 121076 36203941 106402 37550948 389022 14856996 450857 82976279 265823 35885592 105113 52763201 464890 16460173 370583 47361768 102800 93264732 224147 3...
result:
ok 200000 numbers
Test #19:
score: 0
Accepted
time: 115ms
memory: 15704kb
input:
100000 100000000 100000 13 826 839 1853 2693 355 3048 3388 6437 83 6520 2361 8881 486 9368 62 9431 1890 11322 1931 13255 34 13289 144 13434 13 13448 204 13652 770 14423 459 14882 2458 17340 307 17647 86 17733 750 18483 341 18824 5 18830 2202 21032 142 21174 197 21373 1833 23206 1235 24441 829 25271 ...
output:
270080 19124426 402065 514028 6 79589321 4769 54717578 354749 68147578 429863 94588489 411673 22829597 441848 24717944 266625 46799946 415949 70499627 258025 56922184 263881 36221449 100636 41840659 176798 66291098 4 64558329 4 78964491 91 59903485 370881 85175473 128435 35709094 495780 60496080 323...
result:
ok 200000 numbers
Test #20:
score: 0
Accepted
time: 101ms
memory: 14872kb
input:
100000 100000000 100000 7 1 12 1 18 1 23 1 28 1 31 1 38 1 43 1 47 1 51 1 56 1 63 1 68 1 71 1 78 1 83 1 88 1 93 1 96 1 103 1 106 1 113 1 117 1 123 1 126 1 133 1 138 1 143 1 148 1 151 1 158 1 161 1 167 1 172 1 178 1 182 1 187 1 193 1 196 1 203 1 208 1 213 1 218 1 223 1 226 1 233 1 236 1 241 1 248 1 25...
output:
173737 87933 220259 140840 85114 9843 24412 23077 341484 310964 418605 379480 118293 52596 198732 136882 9411 99927013 113029 80241 72672 54536 180299 164818 237496 152813 181887 105493 283055 213193 320814 251282 381120 346685 250861 179079 6 99948467 299872 277448 254025 194296 338330 261333 31532...
result:
ok 200000 numbers
Test #21:
score: 0
Accepted
time: 105ms
memory: 15448kb
input:
100000 100000000 100000 9 1 15 1 24 1 30 1 36 1 45 1 51 1 59 1 66 1 73 1 78 1 85 1 93 1 101 1 107 1 113 1 120 1 128 1 136 1 142 1 150 1 157 1 163 1 170 1 177 1 184 1 191 1 198 1 206 1 211 1 220 1 226 1 234 1 241 1 248 1 253 1 262 1 269 1 275 1 282 1 288 1 297 1 303 1 311 1 317 1 325 1 330 1 339 1 34...
output:
90369 99968717 223170 99968780 23973 99997559 43697 99979289 289971 99947467 478649 99965715 425500 99997417 113919 99934502 450707 99966364 1 553933 1 646248 285339 99901693 397052 99954442 181375 99982364 286682 99952226 97553 99915890 115902 99911289 183955 99959403 305841 99975595 379039 9996556...
result:
ok 200000 numbers
Test #22:
score: 0
Accepted
time: 100ms
memory: 16688kb
input:
100000 100000000 100000 9 1 15 1 20 1 27 1 32 1 40 1 45 1 51 1 58 1 63 1 70 1 76 1 79 1 85 1 94 1 100 1 104 1 109 1 117 1 122 1 129 1 134 1 139 1 148 1 153 1 160 1 163 1 171 1 178 1 183 1 188 1 196 1 199 1 206 1 211 1 218 1 224 1 230 1 237 1 241 1 247 1 255 1 261 1 266 1 274 1 280 1 285 1 291 1 298 ...
output:
318045 99910384 311180 99972997 179713 99916386 337532 99998976 133377 99920747 28258 99943050 13888 99920691 62779 99926942 352316 99933157 272413 99907959 150649 99919031 19273 99982825 129680 99943862 140362 99927489 388997 99921674 280587 99965795 293597 99909487 484741 99948637 374095 99957924 ...
result:
ok 200000 numbers
Test #23:
score: 0
Accepted
time: 1ms
memory: 5588kb
input:
1 1 1 1 1 100000 1
output:
100000 1
result:
ok 2 number(s): "100000 1"
Extra Test:
score: 0
Extra Test Passed