QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#616943 | #1956. Find The House | urayaha_yahaura# | AC ✓ | 4ms | 3976kb | C++14 | 467b | 2024-10-06 13:10:27 | 2024-10-06 13:10:27 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int n,s,a,c;
char b;
unordered_map<int,int>mp;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n;
for(int i=1;i<=n;++i){
cin>>a>>b>>c;
if(b=='L')
mp[a]=a-c;
else
mp[a]=a+c;
}
cin>>s;
while(mp.count(s)){
int t=s;
s=mp[s];
mp.erase(t);
}
cout<<s<<endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3580kb
input:
4 3 R 4 -2 R 5 7 L 5 0 L 2 0
output:
2
result:
ok single line: '2'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
5 10 L 7 1 R 4 -1 R 11 5 L 6 3 L 3 1
output:
0
result:
ok single line: '0'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3508kb
input:
1 100 L 123 100
output:
-23
result:
ok single line: '-23'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3848kb
input:
1000 1217 R 2 1015 R 2 1001 R 2 1281 R 2 105 R 2 1489 R 2 -481 R 2 1419 R 2 111 R 2 -287 R 2 615 R 2 -89 R 2 85 R 2 225 R 2 -443 R 2 1013 R 2 1009 R 2 1245 R 2 1057 R 2 -143 R 2 83 R 2 -103 R 2 163 R 2 -117 R 2 733 R 2 -405 R 2 751 R 2 759 R 2 1207 R 2 507 R 2 351 R 2 -343 R 2 317 R 2 -491 R 2 -421 ...
output:
1497
result:
ok single line: '1497'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3620kb
input:
1000 5799 R 9 4890 R 9 4827 R 9 6087 R 9 795 R 9 7023 R 9 -1842 R 9 6708 R 9 822 R 9 -969 R 9 3090 R 9 -78 R 9 705 R 9 1335 R 9 -1671 R 9 4881 R 9 4863 R 9 5925 R 9 5079 R 9 -321 R 9 696 R 9 -141 R 9 1056 R 9 -204 R 9 3621 R 9 -1500 R 9 3702 R 9 3738 R 9 5754 R 9 2604 R 9 1902 R 9 -1221 R 9 1749 R 9...
output:
7059
result:
ok single line: '7059'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3528kb
input:
1000 3252 L 1 3353 L 1 3360 L 1 3220 L 1 3808 L 1 3116 L 1 4101 L 1 3151 L 1 3805 L 1 4004 L 1 3553 L 1 3905 L 1 3818 L 1 3748 L 1 4082 L 1 3354 L 1 3356 L 1 3238 L 1 3332 L 1 3932 L 1 3819 L 1 3912 L 1 3779 L 1 3919 L 1 3494 L 1 4063 L 1 3485 L 1 3481 L 1 3257 L 1 3607 L 1 3685 L 1 4032 L 1 3702 L ...
output:
3112
result:
ok single line: '3112'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3780kb
input:
1000 -2347 L 8 -1539 L 8 -1483 L 8 -2603 L 8 2101 L 8 -3435 L 8 4445 L 8 -3155 L 8 2077 L 8 3669 L 8 61 L 8 2877 L 8 2181 L 8 1621 L 8 4293 L 8 -1531 L 8 -1515 L 8 -2459 L 8 -1707 L 8 3093 L 8 2189 L 8 2933 L 8 1869 L 8 2989 L 8 -411 L 8 4141 L 8 -483 L 8 -515 L 8 -2307 L 8 493 L 8 1117 L 8 3893 L 8...
output:
-3467
result:
ok single line: '-3467'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3620kb
input:
1000 4584 L 12123 -1306 R 7890 -3128 R 10747 1856 L 2480 -2253 L 7251 -8906 R 8530 -3091 R 2456 5690 L 839 5014 L 3059 -319 R 9674 -5689 R 2452 -9212 R 4233 -8264 R 2225 8605 L 866 9183 L 2195 7580 L 12609 446 R 9303 777 R 6626 8442 L 7112 -8634 R 12093 -9342 R 10164 9025 L 757 3747 R 1399 -2012 R 4...
output:
-1376
result:
ok single line: '-1376'
Test #9:
score: 0
Accepted
time: 1ms
memory: 3848kb
input:
1000 -8024 R 4463 -8647 L 424 -3804 R 5264 -9083 R 14614 -8095 R 11842 -6351 R 774 -9212 R 4233 -8643 L 548 3251 L 3570 -7259 R 4886 1193 R 8629 -4303 L 4387 1529 R 6303 7845 L 7159 -8733 R 2032 147 L 2751 -4511 R 13756 4311 R 5164 3870 L 8961 -4242 R 9196 5481 L 6484 160 R 7036 8419 L 760 -7851 R 1...
output:
-1376
result:
ok single line: '-1376'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
1000 7310 L 14778 -7074 R 14444 -2864 R 852 5528 R 2 -1788 R 3150 7785 L 14358 -4303 L 4387 -3519 R 1822 7459 L 7374 -3831 R 7657 5196 L 7269 9355 L 12410 322 R 4197 -8463 R 17778 9772 L 5188 -2058 R 41 8247 L 13595 2257 L 567 -2568 L 6062 -6325 R 7845 -8063 R 8755 -1984 R 8097 -9667 R 5586 -6120 R ...
output:
-1376
result:
ok single line: '-1376'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
500 -21388 R 65722 -39206 R 34563 41251 L 913 42343 L 8090 37319 L 42892 -8547 R 53916 -22405 R 62355 -5793 R 14838 37149 L 6263 35091 L 63487 15592 R 15553 -5859 R 1819 37311 L 64775 -2901 L 7139 40790 R 3446 6653 L 5118 44334 L 24979 -8508 L 13478 -49225 R 43366 23529 R 12705 10732 R 13768 46030 L...
output:
32175
result:
ok single line: '32175'
Test #12:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
500 44736 L 6231 25184 L 4210 48672 L 21688 -12563 R 9947 40830 L 64386 47410 L 21022 295 R 15707 34617 R 13078 38443 L 25189 38647 L 4621 44372 L 21992 -21403 R 46475 -36580 R 82446 39300 L 9451 36501 L 74772 30040 L 20403 47182 R 690 459 R 46862 47084 L 14827 44620 L 12556 -27879 R 6476 33775 R 99...
output:
11705
result:
ok single line: '11705'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3512kb
input:
500 45315 R 4257 4563 R 26796 38011 L 85387 -12817 R 44074 42009 L 10191 33925 L 5692 6273 R 27052 25996 L 48625 -2019 R 48792 39870 L 14359 30632 L 36913 28025 R 9064 21369 L 60528 -23793 L 4227 12467 L 47974 -15073 R 57429 49766 L 2860 -3546 R 41077 27937 L 67980 22435 R 18258 42879 L 58071 -34326...
output:
-23310
result:
ok single line: '-23310'
Test #14:
score: 0
Accepted
time: 1ms
memory: 3780kb
input:
500 -10203 R 16249 -13820 R 55932 -28934 R 58284 -42169 R 74437 -2162 R 31489 4351 R 22467 49134 L 20079 172 R 15203 26000 R 23426 44180 L 46127 3963 R 39360 15457 R 21237 6046 R 36640 -8407 R 56405 -23172 R 37724 5482 L 30201 40540 L 4159 45145 L 46898 -14065 R 46373 42957 L 78 22874 R 20654 -30477...
output:
37353
result:
ok single line: '37353'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3508kb
input:
500 13644 L 59467 45351 R 222 10452 R 30384 36707 L 65188 41978 L 14291 49074 L 19088 32938 L 12659 -47990 R 82969 30349 L 8062 24241 R 25132 42603 R 5836 16919 R 27257 16585 R 17267 40765 L 1861 28897 L 2796 -5148 R 48152 33830 R 9263 -11780 R 83 4178 R 39112 -987 R 47308 46458 L 80973 41695 R 7379...
output:
20030
result:
ok single line: '20030'
Test #16:
score: 0
Accepted
time: 1ms
memory: 3828kb
input:
1000 44024 R 51379 95950 R 3493 84655 L 16609 86596 L 66028 19081 R 80790 96879 L 3240 -12532 R 85079 33138 L 1057 77081 L 10011 93639 L 10832 99824 R 77 97484 L 30416 99057 L 2120 78381 L 31934 62171 R 4098 81382 L 20370 95045 L 105069 59882 L 22544 -10475 R 105750 92313 R 5479 98039 L 18943 93750 ...
output:
66404
result:
ok single line: '66404'
Test #17:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
1000 64995 L 97402 99256 L 18161 99176 L 11259 91024 L 15151 57282 R 36424 57779 R 21418 82309 L 6247 -12042 R 82152 97872 L 10725 93791 L 19650 -32407 R 115135 81059 L 11495 92802 L 48717 46767 L 4726 28699 L 99008 79197 R 14194 94066 L 46882 97450 L 111 72877 L 59330 26433 R 42254 87940 L 71986 81...
output:
-10237
result:
ok single line: '-10237'
Test #18:
score: 0
Accepted
time: 1ms
memory: 3620kb
input:
1000 31520 L 44845 85947 L 30959 46251 R 35515 -35520 R 88096 68722 R 22070 74385 L 98888 12700 R 83728 91310 L 56415 98998 L 18043 93068 R 3475 7750 R 79232 83327 R 3794 93975 L 10098 -25758 R 120644 81863 L 12132 84766 R 12867 66460 R 13261 61721 R 10949 61006 R 31827 -34631 R 86158 60690 R 37301 ...
output:
85570
result:
ok single line: '85570'
Test #19:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
1000 98161 L 5095 24670 R 67992 96617 L 64915 96902 L 165354 80225 R 958 -88349 R 105881 91724 L 43818 54732 R 13946 92294 L 1227 73536 L 18620 83915 L 39955 80970 L 60242 29419 R 23277 47502 L 1459 72442 L 8694 91660 L 4807 34744 R 48188 49045 R 44016 43063 R 27442 88925 R 5479 84161 R 4563 97096 L...
output:
8879
result:
ok single line: '8879'
Test #20:
score: 0
Accepted
time: 1ms
memory: 3532kb
input:
1000 45086 R 22159 65699 R 32964 16197 R 76408 84504 L 110691 80775 R 18943 94115 L 32173 87534 R 836 -79673 R 179000 67739 L 10174 59489 R 37570 91416 R 1812 58415 R 39001 18613 R 49843 94316 L 2476 64445 R 2198 95625 L 1221 75215 L 30240 79177 L 3764 85810 L 2522 96511 L 82980 95461 R 2659 74100 L...
output:
77767
result:
ok single line: '77767'
Test #21:
score: 0
Accepted
time: 2ms
memory: 3768kb
input:
5000 415029 R 75446 -188830 R 324463 385358 L 505537 205599 R 17849 -415461 R 650495 -417730 R 492610 -370135 R 152868 -444548 R 253561 -474730 R 350614 429361 L 618825 -211640 L 11222 332129 R 16242 -86296 R 470047 438917 L 734032 383442 L 447822 -203202 L 155440 473389 L 946272 -447806 R 211284 -8...
output:
238704
result:
ok single line: '238704'
Test #22:
score: 0
Accepted
time: 2ms
memory: 3688kb
input:
5000 -183747 R 607373 414686 L 456048 -452116 R 479398 1654 R 185234 116603 L 21937 245974 L 550239 317888 L 651189 483138 L 672871 -422373 R 199560 118056 L 170387 -53774 L 409601 -294457 R 538312 222532 R 136751 -121129 L 113685 -148967 L 196741 492209 L 983633 51147 R 183738 -419748 R 748116 -481...
output:
-457204
result:
ok single line: '-457204'
Test #23:
score: 0
Accepted
time: 2ms
memory: 3780kb
input:
5000 66356 R 280087 -167573 L 291094 336298 L 55176 -27646 R 341346 -197206 L 250126 281122 L 438984 441332 R 24639 -197379 L 172193 -301110 R 587042 90509 L 227632 435530 L 883290 -78688 R 204425 303566 L 468893 -280567 R 110215 -325101 L 87895 -257987 R 126908 97989 R 268419 459647 L 169759 283826...
output:
335910
result:
ok single line: '335910'
Test #24:
score: 0
Accepted
time: 2ms
memory: 3660kb
input:
5000 -499201 R 851523 -37960 L 346901 414118 L 355512 142491 R 224075 210743 L 64875 224762 R 65248 219654 L 597708 -439094 R 311817 -418520 R 283830 176648 L 509406 -67230 R 14189 -440586 R 834719 427692 L 255581 -219091 R 210769 278896 L 403845 259708 L 537912 100710 R 113218 -30707 L 381196 -3672...
output:
-239648
result:
ok single line: '-239648'
Test #25:
score: 0
Accepted
time: 2ms
memory: 3768kb
input:
5000 459509 L 740670 -318124 R 129719 248264 L 697339 69596 R 78072 -150403 R 59195 385661 R 95775 340895 L 344352 126449 L 311466 6428 L 324671 320039 L 137298 -306649 R 631760 -471627 R 225235 62436 L 107126 447780 L 605256 -344029 R 640575 122725 L 563397 286272 L 520105 -27785 R 334629 -486545 R...
output:
-408012
result:
ok single line: '-408012'
Test #26:
score: 0
Accepted
time: 3ms
memory: 3940kb
input:
10000 918245 L 1396739 -595156 R 770602 416776 L 941633 -844601 R 215184 -340335 R 420278 -749299 R 903916 488582 L 1148966 353973 L 806510 331395 L 829954 960531 L 1773771 168423 L 609263 -784563 R 208552 431175 L 66656 462159 L 123012 122024 L 721475 935670 R 16572 60744 R 638755 -538070 R 318657 ...
output:
-957095
result:
ok single line: '-957095'
Test #27:
score: 0
Accepted
time: 3ms
memory: 3976kb
input:
10000 -692218 R 1541989 -769416 R 635859 -420987 R 1091541 265806 L 392022 965205 L 826889 175 R 713842 189046 R 789711 232477 R 448738 -30387 R 262142 -262605 R 297298 233298 L 82003 -148526 L 598292 674810 R 283224 -825470 R 1026525 981288 L 357708 861508 L 1281630 927782 L 1401704 -520133 R 69683...
output:
262318
result:
ok single line: '262318'
Test #28:
score: 0
Accepted
time: 3ms
memory: 3968kb
input:
10000 -534414 L 257642 814004 L 541736 848741 L 239955 -248316 R 931252 -923277 R 1106449 -496330 R 873242 -774020 R 1520232 339714 R 425448 936093 L 1360728 98931 R 586027 -739375 R 890015 -346736 R 660903 -14399 L 118316 366501 L 712590 -506749 R 896590 420070 R 398761 -488224 R 1400856 25944 R 69...
output:
803687
result:
ok single line: '803687'
Test #29:
score: 0
Accepted
time: 4ms
memory: 3880kb
input:
10000 548969 L 253740 -687914 R 1563175 387712 L 77077 -240555 R 734037 -124983 L 3431 91236 R 513415 109704 R 155857 563752 L 263861 -288715 L 573988 -303855 R 1281177 283422 R 609863 511262 L 1370894 -670763 L 311983 -736719 R 1433342 325632 L 154788 -13311 R 389574 -877341 R 344544 -333961 R 3923...
output:
120578
result:
ok single line: '120578'
Test #30:
score: 0
Accepted
time: 3ms
memory: 3904kb
input:
10000 -352461 L 41040 560790 L 1475385 -200210 L 452846 -911402 R 1012081 729593 R 59193 711680 L 902446 -311257 R 785604 -920838 R 1808306 353996 L 6005 -354042 R 971630 303761 L 1136597 467473 R 207428 725746 L 1547067 825907 L 638709 731416 R 126829 574371 L 469566 120570 L 1110390 -207427 L 5005...
output:
12940
result:
ok single line: '12940'