QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#721195 | #9480. Hotel | OneWan# | AC ✓ | 160ms | 13236kb | C++23 | 1.7kb | 2024-11-07 15:32:30 | 2024-11-07 15:32:30 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int q;
cin >> q;
map<int, int>mp, mp1;
mp[1] = 1;
int add = 0;
vector<pair<int, int>>v;
int mx = 1;
while(q--) {
int t, x;
cin >> t >> x;
if(t == 1) {
add++;
mp[1 - add] = x;
mx++;
}
else if(t == 2) {
mx *= 2;
mp1.clear();
for (auto &[idx, v] : mp) {
if((idx + add) * 2 <= (int)1e9)
mp1[((idx + add) * 2)] = v;
}
swap(mp, mp1);
v.push_back({x, add});
add = 0;
}
else {
// cout << x << ' ' << mx << ',';
// for (auto &[it, c] : mp)
// cout << it + add << ' ' << c << '\n';
if(x > mx) {
cout << "-1\n";
continue;
}
else if(mp.count(x - add)) cout << mp[x - add] << '\n';
else {
int cnt = 0;
x -= add;
for (auto it = v.rbegin(); it != v.rend() && cnt < 32; it++, cnt++) {
// cout << '?' << x << ' ' << it->first << ' ' << it->second << '\n';
if(x & 1) {
cout << it->first << '\n';
break;
}
else x /= 2, x -= it->second;
}
}
}
mx = min(mx, (int)1e9);
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3528kb
input:
6 1 4 3 3 1 3 3 2 2 3 3 2
output:
-1 4 3
result:
ok 3 tokens
Test #2:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
8 1 8 2 5 2 5 3 7 3 8 3 9 2 3 3 1
output:
5 1 -1 3
result:
ok 4 tokens
Test #3:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
2 1 28 3 3
output:
-1
result:
ok "-1"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
19 3 1 1 65 2 91 3 1 1 30 1 20 3 1 3 1 1 45 3 3 3 6 1 78 2 64 2 43 3 16 3 16 1 59 2 31 3 9
output:
1 91 20 20 30 91 30 30 31
result:
ok 9 tokens
Test #5:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
20 2 28 2 5 2 91 3 21 2 60 1 37 3 62 2 15 2 35 1 47 1 64 1 74 1 55 3 51 3 63 2 90 3 71 2 14 1 38 1 25
output:
-1 -1 35 35 90
result:
ok 5 tokens
Test #6:
score: 0
Accepted
time: 0ms
memory: 3500kb
input:
17 2 13 1 83 2 100 3 98 2 84 1 72 1 83 3 100 2 95 1 2 2 53 2 99 3 9 3 35 3 88 3 17 3 16
output:
-1 -1 99 99 95 99 95
result:
ok 7 tokens
Test #7:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
19 1 68 3 14 1 72 2 51 2 9 2 68 3 41 3 1 2 83 3 68 2 4 3 66 3 71 1 15 2 16 2 86 2 1 1 62 1 77
output:
-1 -1 68 -1 83 4
result:
ok 6 tokens
Test #8:
score: 0
Accepted
time: 3ms
memory: 3656kb
input:
4662 2 539431786 1 921511657 1 149186751 2 698955985 2 639868522 2 694839539 1 668474283 2 75841919 1 894647940 2 937025195 3 4 3 52 1 939170230 2 855428426 1 660661225 1 182718503 1 566400847 2 519429871 3 304 1 432294863 3 124 1 737105929 3 296 3 479 2 308940138 3 768 3 1053 1 309488827 1 26465924...
output:
75841919 75841919 855428426 519429871 937025195 519429871 937025195 308940138 308940138 802991807 40057340 474274747 679543808 54062716 54062716 858767291 54062716 54062716 470263749 470263749 887366069 54062716 470263749 470263749 814619937 470263749 470263749 863114429 7295049 63593073 231361687 4...
result:
ok 1576 tokens
Test #9:
score: 0
Accepted
time: 2ms
memory: 3660kb
input:
3193 2 773885843 3 1 1 47762676 1 902488841 1 989512151 1 771635026 1 685159175 1 469230755 3 8 1 592927517 3 3 2 364713801 2 930305974 3 4 1 12117819 3 9 3 34 2 853304445 3 40 3 50 2 851058408 3 97 3 74 2 242475081 3 136 2 422886467 2 577736742 3 266 1 941103152 3 283 3 931 3 167 2 876861094 2 2048...
output:
773885843 1 685159175 592927517 469230755 930305974 930305974 902488841 851058408 853304445 771635026 422886467 422886467 422886467 422886467 204860715 422886467 187383902 242475081 498132348 296104656 427769681 834738164 834738164 620718970 12530205 637654610 637654610 637654610 637654610 388796233...
result:
ok 1055 tokens
Test #10:
score: 0
Accepted
time: 2ms
memory: 3692kb
input:
3537 3 110188064 3 792048480 1 151348462 2 106761621 1 901138927 3 28721523 1 9240758 2 352394650 3 907345615 2 175018944 3 566202068 1 319132125 2 688434033 2 751396924 2 187861240 1 189882170 3 806842750 1 853158986 1 139586651 3 79938839 3 722477466 1 631254396 2 335701562 1 93464981 2 121746876 ...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 916212214 -1 779943165 29454641 779943165 675612352 916212214 46056015 238698126 952326340 641274205 952326340 49963101 49963101 49963101 49963101 787951730 369502295 501912072 746519312 744225302 49963101 847627241 501912072 14272603 92031...
result:
ok 1193 tokens
Test #11:
score: 0
Accepted
time: 2ms
memory: 3588kb
input:
3356 1 49248061 1 638423285 1 635097296 2 612030548 3 428715068 2 584646637 3 773075796 2 81411773 3 13600590 1 527263406 1 130129694 1 306880607 2 148328224 2 808672395 2 910319355 1 267960843 1 125502013 1 312125150 2 772138497 1 893835075 2 628218261 3 599610221 2 702939691 1 861596481 3 75424836...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 675442240 675442240 375689156 740848011 63529291 63529291 268323239 840127847 435947115 214983673 986316561 214983673 484394255 484394255 152868635 152868635 994474618 994474618 994474618 994474618 484394255 154053340 152868635 416775641 770346577 9815659...
result:
ok 1098 tokens
Test #12:
score: 0
Accepted
time: 2ms
memory: 3892kb
input:
3582 1 688574378 3 38769265 3 822354211 2 299644632 2 276829571 3 324429234 2 921938698 2 757423164 1 261329344 2 147139887 1 335235361 1 405471751 1 686962551 2 228814700 3 533691623 2 502186472 3 716236267 3 103854037 3 117525860 3 216131609 3 259751411 3 996606347 2 886493435 3 418359829 1 581400...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 715089970 128017783 817471734 817471734 817471734 209228901 288462081 445228751 116259812 116259812 116259812 4978098 985919240 985919240 116259812 670960269 284617052 586512198 567877280 940747252 228454...
result:
ok 1172 tokens
Test #13:
score: 0
Accepted
time: 55ms
memory: 3824kb
input:
117262 3 1 3 1 2 739603428 3 2 1 736101960 3 3 1 246109068 1 992925309 3 4 1 754777897 2 54179842 3 11 2 689576691 1 529251832 1 346452461 3 8 1 191512187 1 97143224 1 79472549 2 16130649 3 47 1 112969780 1 424003414 2 216821357 3 58 1 24625336 1 764754006 1 47160825 3 85 2 798280852 2 887255849 1 7...
output:
1 1 1 1 739603428 54179842 54179842 16130649 16130649 16130649 394467883 451169892 289354244 545061924 654116956 983861186 983861186 545061924 599313245 599313245 599313245 324881690 645448257 269372073 645448257 269372073 269372073 269372073 116581115 743022649 743022649 800104989 915366831 2061073...
result:
ok 39045 tokens
Test #14:
score: 0
Accepted
time: 31ms
memory: 3688kb
input:
61107 3 1 3 1 2 105313735 2 177765573 3 2 1 598213130 3 2 2 766993641 3 1 3 10 2 763882891 3 19 1 269438478 1 813605452 2 420112826 3 21 2 257302287 2 47971452 3 135 2 402195234 1 440348393 2 9473247 1 12890468 3 121 2 528592413 2 579649461 3 1800 2 7355964 3 282 2 552609465 1 74631129 2 932837846 1...
output:
1 1 105313735 177765573 766993641 1 763882891 420112826 47971452 402195234 9473247 579649461 528592413 552609465 932837846 19877160 19877160 211049858 460623890 290550403 460623890 292564856 290550403 94575615 411532419 393298181 94575615 424727200 612741015 757047221 87711028 470904849 667959398 66...
result:
ok 20477 tokens
Test #15:
score: 0
Accepted
time: 3ms
memory: 3984kb
input:
18011 1 781270287 2 323797883 2 170669887 3 987933888 1 491894467 2 855879168 1 959571220 2 898369217 1 757213905 3 654196440 2 232100527 1 60204090 3 909756042 3 28766421 1 53287689 1 657618731 1 612356680 2 280996074 2 833102642 1 971745509 2 321965651 1 138404268 2 618406269 2 661943661 2 1449435...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 798379220 798379220 119051428 403520216 45704788 876695676 403520216 403520216 593450329 287106614 239396065 593450329 950312839 287106614 975980518 975980518 747818485 747818485 756222860 415863189 937776127 275482423 756222860 481935210 216287366 137742965...
result:
ok 6135 tokens
Test #16:
score: 0
Accepted
time: 78ms
memory: 3828kb
input:
159145 1 496838392 2 853217278 3 622250366 1 498649624 3 946168380 2 491830143 1 78573363 1 161574675 2 214601815 2 43462979 2 100700661 1 668384802 1 471341923 2 894761787 3 741319566 3 867234885 1 10793540 3 655187665 1 681434545 2 820599886 3 168479054 2 620366864 1 900051418 2 321613831 2 383852...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 939798961 84740894 84740894 951399271 442210249 442210249 270140411 592571201 42112908 584113621 592571201 584113621 826362267 52519744 334901965 334901965 639505503 639505503 334901965 334901965 361398697 66065016 334901965 66065016 66065016 ...
result:
ok 52911 tokens
Test #17:
score: 0
Accepted
time: 31ms
memory: 3704kb
input:
63584 2 158137455 3 100400784 2 997994332 3 822100585 1 380045918 2 60816123 3 872696338 1 56590512 2 847833618 2 114343100 1 787111837 3 94467472 3 410789016 1 39324396 1 832915095 1 365835362 2 101646543 2 227468237 2 20596778 3 901810802 3 912764239 1 609092651 3 910800292 1 49570746 2 884928902 ...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 244957211 719318358 719318358 719318358 82951341 719318358 763199201 82951341 265231421 570033028 64872083 570033028 265231421 570033028 570033028 570033028 64872083 570033028 1...
result:
ok 21296 tokens
Test #18:
score: 0
Accepted
time: 95ms
memory: 4216kb
input:
200000 1 609841649 3 40466926 2 325258643 3 831946678 3 551116632 1 904348034 3 737947568 3 122734845 3 823302897 1 436648779 2 630921511 2 327431715 1 431535463 2 2058613 3 247821164 3 936863282 3 747872255 2 319181933 2 16356635 2 464586827 2 632760506 2 796055504 3 50320545 3 317921607 3 77938412...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 182885117 -1 -1 433288695 27607090 433288695 871447194 871447194 747185215 871447194 871447194 871447194 747185215 29842859 722261147 275307207 89119083 73980805 73980805 187775870 186271926 186271926 857440782 857440782 73980805 8...
result:
ok 66843 tokens
Test #19:
score: 0
Accepted
time: 95ms
memory: 4280kb
input:
199990 3 691986643 3 247320281 2 483933009 1 269507884 2 112063388 3 163004366 1 590820901 2 552311184 3 649477944 1 615636285 1 709994812 3 687209309 3 202313028 1 724611849 3 841824354 1 885043026 3 809251654 2 2518097 3 949260972 3 441683259 1 429810394 1 962671518 3 799061021 2 534971718 1 16429...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 963038292 -1 103665250 61681072 103665250 761293431 854881788 448431231 70635011 751322763 660018862 373897766 618562394 740401455 755979964 941732226 941732226 155159111 155159111 710585637 941732226 ...
result:
ok 66411 tokens
Test #20:
score: 0
Accepted
time: 126ms
memory: 12996kb
input:
199994 1 200987904 1 139955786 1 827443511 1 768390407 1 226440117 1 660999952 1 767420568 1 793887548 1 507605028 1 432477580 1 494280300 1 342762996 1 806339561 1 775540453 1 286434750 1 669337471 1 262114052 1 176281956 1 515889739 1 846125188 1 452934743 1 883900151 1 940044563 1 57500696 1 1944...
output:
-1 -1 -1 -1 -1 -1 -1 -1 494280300 -1 -1 -1 -1 -1 -1 -1 -1 -1 767420568 -1 -1 -1 -1 -1 -1 342762996 -1 -1 793887548 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 507605028 767420568 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 768390407 -1 432477580 -1 -1 827443511 -1 -1 494280300 -1 -1 342762996 -1 -1 -1 -1 -...
result:
ok 99993 tokens
Test #21:
score: 0
Accepted
time: 131ms
memory: 12936kb
input:
200000 1 282148840 1 983534793 1 473085764 1 872236493 1 140687614 1 505530797 1 324534301 1 989017828 1 636387414 1 427015561 1 184716816 1 128067031 1 304671964 1 647583487 1 277658075 1 439288467 1 741056088 1 744440267 1 988191540 1 16412299 1 594413464 1 965518582 1 103003716 1 862016925 1 3738...
output:
-1 -1 -1 -1 184716816 -1 -1 -1 473085764 -1 -1 -1 184716816 -1 983534793 872236493 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 184716816 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 140687614 -1 473085764 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 872236493 324534301 -1 -1 505530797 -1 -1 -1 -1 -1 -...
result:
ok 99996 tokens
Test #22:
score: 0
Accepted
time: 132ms
memory: 12992kb
input:
199995 1 540505287 1 332927298 1 388336584 1 438155442 1 725692881 1 486621072 1 962101484 1 314760887 1 542978305 1 778489208 1 75342874 1 769934297 1 43627918 1 914110561 1 453793479 1 488015932 1 24391916 1 341600186 1 818130013 1 594045562 1 539069656 1 550723187 1 226147181 1 727696202 1 199419...
output:
-1 -1 -1 -1 -1 962101484 -1 -1 -1 -1 -1 -1 -1 -1 769934297 -1 -1 -1 -1 -1 332927298 -1 -1 -1 -1 -1 -1 962101484 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 75342874 314760887 388336584 -1 -1 -1 -1 -1 -1 -1 778489208 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 75342874 -1 542978305 -1 -1 -1 -1 314760887 -1 -1 -1 -1 ...
result:
ok 99994 tokens
Test #23:
score: 0
Accepted
time: 160ms
memory: 13224kb
input:
199998 1 905225781 1 143202120 1 924741921 1 92243558 1 398521249 1 824039058 1 316860326 1 290929000 1 591213385 1 289766242 1 497507018 1 255546693 1 714495447 1 764133139 1 523714295 1 867572370 1 76310035 1 388580620 1 468424683 1 125694260 1 815261478 1 850339455 1 463242008 1 776836055 1 41376...
output:
290929000 591213385 591213385 290929000 591213385 398521249 591213385 398521249 290929000 497507018 316860326 398521249 289766242 143202120 497507018 398521249 497507018 924741921 290929000 92243558 143202120 824039058 591213385 591213385 92243558 289766242 290929000 591213385 289766242 92243558 398...
result:
ok 99994 tokens
Test #24:
score: 0
Accepted
time: 141ms
memory: 13236kb
input:
200000 1 793882655 1 869943403 1 917616888 1 861115000 1 736590547 1 551765689 1 17639508 1 755774980 1 801118506 1 520074290 1 850338367 1 260433798 1 591832496 1 729133547 1 156746585 1 173962200 1 296002649 1 674563304 1 418363489 1 673123803 1 233169542 1 515049498 1 996480620 1 182772159 1 7534...
output:
801118506 260433798 917616888 520074290 861115000 755774980 755774980 850338367 917616888 755774980 260433798 260433798 917616888 801118506 520074290 260433798 850338367 917616888 520074290 917616888 520074290 869943403 260433798 755774980 869943403 17639508 861115000 861115000 551765689 917616888 7...
result:
ok 99996 tokens
Test #25:
score: 0
Accepted
time: 148ms
memory: 13232kb
input:
199994 1 181740787 1 899777576 1 727628249 1 861368791 1 762302231 1 423088875 1 988229366 1 860997156 1 434399189 1 699891456 1 785898967 1 421266475 1 460775312 1 699308308 1 232725461 1 718552438 1 515817452 1 426142546 1 532290286 1 3432742 1 27282122 1 832119193 1 256644389 1 665023385 1 907384...
output:
423088875 988229366 860997156 423088875 727628249 699891456 861368791 785898967 421266475 434399189 899777576 421266475 861368791 421266475 785898967 762302231 988229366 434399189 727628249 423088875 423088875 860997156 785898967 988229366 727628249 861368791 434399189 762302231 860997156 899777576 ...
result:
ok 99993 tokens
Test #26:
score: 0
Accepted
time: 41ms
memory: 8312kb
input:
200000 1 58894811 1 236216518 1 594291651 1 663576092 1 145424330 1 414465061 1 444503027 1 740723362 1 726122861 1 956745201 1 150097818 1 517603974 1 798588931 1 527652385 1 822108116 1 145919347 1 485421664 1 284603441 1 438587272 1 457287772 1 144699834 1 83893914 1 6660070 1 206487510 1 4043978...
output:
1 956745201 414465061 145424330 740723362 444503027 145424330 956745201 236216518 145424330 956745201 740723362 663576092 414465061 145424330 663576092 956745201 726122861 236216518 956745201 236216518 444503027 58894811 444503027 236216518 594291651 145424330 236216518 956745201 740723362 58894811 ...
result:
ok 100000 tokens
Test #27:
score: 0
Accepted
time: 32ms
memory: 8244kb
input:
200000 1 548059287 1 837640483 1 671688468 1 294650284 1 187060315 1 60754701 1 938978625 1 30601965 1 393634741 1 754816301 1 747928166 1 497477738 1 450835785 1 373896635 1 883854414 1 52676989 1 522964180 1 972478369 1 908359834 1 360097314 1 496955458 1 351355332 1 173934489 1 538342239 1 161950...
output:
294650284 294650284 393634741 294650284 393634741 938978625 548059287 938978625 754816301 938978625 1 1 548059287 60754701 1 754816301 938978625 1 60754701 548059287 294650284 671688468 60754701 1 294650284 754816301 30601965 837640483 1 1 1 60754701 187060315 548059287 837640483 60754701 1 18706031...
result:
ok 100000 tokens
Test #28:
score: 0
Accepted
time: 40ms
memory: 8192kb
input:
200000 1 541064886 1 462467554 1 105065511 1 829074312 1 932939459 1 37490047 1 831885062 1 227581122 1 8181080 1 627843390 1 776470204 1 59807127 1 707938066 1 419070770 1 999354027 1 344478144 1 912593291 1 306445187 1 311824203 1 956761836 1 857335468 1 284529615 1 44587126 1 896842907 1 10693442...
output:
105065511 541064886 105065511 831885062 227581122 831885062 831885062 627843390 1 932939459 831885062 8181080 541064886 8181080 541064886 462467554 37490047 105065511 541064886 831885062 829074312 37490047 541064886 227581122 105065511 462467554 831885062 8181080 462467554 105065511 831885062 932939...
result:
ok 100000 tokens
Test #29:
score: 0
Accepted
time: 41ms
memory: 8248kb
input:
200000 1 827305960 1 947602559 1 603604352 1 870154530 1 400246549 1 289816342 1 360811690 1 91772246 1 275856755 1 723338096 1 399582284 1 220752203 1 61184282 1 55368672 1 684426110 1 567295732 1 907837052 1 616038556 1 70563318 1 541941291 1 249972794 1 940566749 1 163312601 1 370268193 1 1680861...
output:
360811690 400246549 91772246 870154530 91772246 91772246 289816342 947602559 289816342 827305960 360811690 400246549 91772246 827305960 723338096 947602559 275856755 947602559 870154530 289816342 360811690 870154530 827305960 289816342 289816342 603604352 400246549 870154530 723338096 827305960 1 28...
result:
ok 100000 tokens
Test #30:
score: 0
Accepted
time: 28ms
memory: 3580kb
input:
200000 1 271967082 2 499315927 1 286655579 2 615186483 1 684567938 2 87373644 1 876148262 2 42317138 1 455990351 2 776498120 1 641429186 2 769180526 1 175088074 2 461263542 1 390764670 2 700845799 1 491671953 2 734959536 1 278490686 2 650283961 1 228338354 2 516559398 1 70365665 2 107371409 1 151840...
output:
617302186 9553168 617302186 617302186 9553168 106736807 617302186 617302186 617302186 617302186 652419279 617302186 459496040 106736807 617302186 617302186 617302186 617302186 9553168 617302186 617302186 459496040 617302186 617302186 617302186 106736807 339719506 617302186 617302186 617302186 955316...
result:
ok 199872 tokens
Extra Test:
score: 0
Extra Test Passed