QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#23772 | #2961. Pawn Shop | George_Plover# | AC ✓ | 679ms | 24700kb | C++20 | 906b | 2022-03-19 13:32:36 | 2022-04-30 04:06:43 |
Judging History
answer
#include <bits/stdc++.h>
#define N 300005
using namespace std;
int a[2][N], b[N << 1], c[N << 1], n;
map<int, int> m;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
for (int k = 0; k < 2; k++)
{
for (int i = 1; i <= n; i++)
{
cin >> a[k][i];
if (!m.count(a[k][i]))
{
m[a[k][i]] = m.size();
b[m[a[k][i]]] = a[k][i];
}
a[k][i] = m[a[k][i]];
}
}
for (int i = 1, j = 0; i <= n; i++)
{
if (a[0][i] != a[1][i])
{
j -= abs(c[a[0][i]]) + abs(c[a[1][i]]);
j += abs(++c[a[0][i]]) + abs(--c[a[1][i]]);
}
cout << b[a[1][i]] << (i == n ? '\n' : ' ');
if (i < n && !j)
cout << "# ";
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 4ms
memory: 7728kb
input:
8 1 2 6 2 7 9 8 5 2 6 1 2 9 7 5 8
output:
2 6 1 # 2 # 9 7 # 5 8
result:
ok single line: '2 6 1 # 2 # 9 7 # 5 8'
Test #2:
score: 0
Accepted
time: 4ms
memory: 7768kb
input:
4 1 1 2 1 2 1 1 1
output:
2 1 1 # 1
result:
ok single line: '2 1 1 # 1'
Test #3:
score: 0
Accepted
time: 1ms
memory: 7676kb
input:
3 1 2 5 2 5 1
output:
2 5 1
result:
ok single line: '2 5 1'
Test #4:
score: 0
Accepted
time: 514ms
memory: 16364kb
input:
300000 906691060 413654000 813847340 955892129 451585302 43469774 278009743 548977049 521760890 434794719 985946605 841597327 891047769 325679555 511742082 384452588 626401696 957413343 975078789 234551095 541903390 149544007 302621085 150050892 811538591 101823754 663968656 858351977 268979134 9768...
output:
621034489 247987794 928717554 379551985 529890438 468341422 119259073 488341364 379430468 645661972 791821411 964770773 201090787 27277026 471149591 818924206 843881699 947247640 177756968 87048344 672635394 114848229 128230137 890656449 880511640 681224058 285219012 898264695 352698501 54131049 809...
result:
ok single line: '621034489 247987794 928717554 ...5 928717554 247987794 621034489'
Test #5:
score: 0
Accepted
time: 1ms
memory: 7832kb
input:
1 1 1
output:
1
result:
ok single line: '1'
Test #6:
score: 0
Accepted
time: 4ms
memory: 7632kb
input:
2 2 1 1 2
output:
1 2
result:
ok single line: '1 2'
Test #7:
score: 0
Accepted
time: 49ms
memory: 9380kb
input:
300000 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 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 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
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 # 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 # ...
result:
ok single line: '1 # 1 # 1 # 1 # 1 # 1 # 1 # 1 ...# 1 # 1 # 1 # 1 # 1 # 1 # 1 # 1'
Test #8:
score: 0
Accepted
time: 322ms
memory: 24432kb
input:
300000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
300000 299999 299998 299997 299996 299995 299994 299993 299992 299991 299990 299989 299988 299987 299986 299985 299984 299983 299982 299981 299980 299979 299978 299977 299976 299975 299974 299973 299972 299971 299970 299969 299968 299967 299966 299965 299964 299963 299962 299961 299960 299959 299958...
result:
ok single line: '300000 299999 299998 299997 29...4 13 12 11 10 9 8 7 6 5 4 3 2 1'
Test #9:
score: 0
Accepted
time: 4ms
memory: 7836kb
input:
4 1 5 3 3 3 3 5 1
output:
3 3 5 1
result:
ok single line: '3 3 5 1'
Test #10:
score: 0
Accepted
time: 3ms
memory: 9728kb
input:
4 1 5 2 4 2 4 1 5
output:
2 4 1 5
result:
ok single line: '2 4 1 5'
Test #11:
score: 0
Accepted
time: 679ms
memory: 22912kb
input:
300000 825052947 222413313 420486732 733200245 447285522 849452317 778574636 665107857 191922037 552090989 340702344 364180267 397869146 822742091 528639181 502847798 661100210 279303919 925189429 605103232 453769981 832330450 633684899 471275559 471609055 755211946 423820506 512558721 808066278 535...
output:
825052947 # 222413313 # 420486732 # 733200245 # 447285522 # 849452317 # 778574636 # 665107857 # 191922037 # 552090989 # 340702344 # 364180267 # 397869146 # 822742091 # 528639181 # 502847798 # 661100210 # 279303919 # 925189429 # 605103232 # 453769981 # 832330450 # 633684899 # 471275559 # 471609055 # ...
result:
ok single line: '825052947 # 222413313 # 420486...1757477 # 273508655 # 874867852'
Test #12:
score: 0
Accepted
time: 646ms
memory: 23660kb
input:
300000 548813925 271217096 713365458 430393505 917676614 727769462 122585834 879014061 469221736 729912569 216223919 504329958 563422180 562345704 703588368 42861412 12143447 713351927 260644746 914986781 542505083 610410840 412189240 43904862 151536721 364208947 154564293 973029570 773850043 714475...
output:
548813925 # 271217096 # 713365458 # 430393505 # 917676614 # 727769462 # 122585834 # 879014061 # 469221736 # 729912569 # 216223919 # 504329958 # 563422180 # 562345704 # 703588368 # 42861412 # 12143447 # 713351927 # 260644746 # 914986781 # 542505083 # 610410840 # 412189240 # 43904862 # 151536721 # 364...
result:
ok single line: '548813925 # 271217096 # 713365...9358751 # 758486949 # 404256538'
Test #13:
score: 0
Accepted
time: 562ms
memory: 24700kb
input:
300000 490189606 702335127 171720709 943818540 74197088 492949633 985677175 257491136 922116387 84057927 677457410 251897643 783554823 474175743 583629088 473876741 903513802 93493309 381459379 941352432 258158276 741274999 817584815 398325324 206744865 200431978 929882463 99765127 349281621 6948497...
output:
490189606 # 702335127 # 171720709 # 943818540 # 74197088 # 492949633 # 985677175 # 257491136 # 922116387 # 84057927 # 677457410 # 251897643 # 783554823 # 474175743 # 583629088 # 473876741 # 903513802 # 93493309 # 381459379 # 941352432 # 258158276 # 741274999 # 817584815 # 398325324 # 206744865 # 200...
result:
ok single line: '490189606 # 702335127 # 171720...6731832 # 739157042 # 949829191'
Test #14:
score: 0
Accepted
time: 650ms
memory: 24116kb
input:
300000 755419293 649605063 733167158 183113794 873645501 735259092 1344821 259736512 262828936 214059078 197629410 513200707 889991024 684836200 414399014 803263382 110471247 33634825 70192564 781675679 837459013 998993404 596010968 779599273 179449511 443074886 497139260 355678336 904105905 8538450...
output:
425081771 194010832 138891039 876196942 325146894 358559217 568974180 64321601 254289266 751271677 599553546 729224603 718211936 163527286 993500870 486765673 535313435 229752447 214558426 269796249 332634401 364929205 130231389 902149859 567860709 223201296 947099457 787528975 231002486 393140607 7...
result:
ok single line: '425081771 194010832 138891039 ...9 470833804 445561159 983005315'
Test #15:
score: 0
Accepted
time: 631ms
memory: 24104kb
input:
300000 115134212 853760039 633580319 433084231 772188713 156558762 525639790 660862041 708627436 984272672 475666942 57836129 359257867 119170523 687576740 883112848 970317816 428605793 664920101 110368004 403089722 176675189 827527436 181491804 231781108 373364879 745114459 28641168 465472344 69366...
output:
784659346 547015164 675086962 758744217 191250515 678989199 977526159 666874222 822366248 827527436 122665664 426191465 760786466 57836129 290422018 180929330 608107296 618357425 972579591 416856994 478831119 105501753 499624484 831473886 424309082 4112930 167964625 609149095 88797143 547574080 9239...
result:
ok single line: '784659346 547015164 675086962 ...2 797046328 301742359 218857972'
Test #16:
score: 0
Accepted
time: 637ms
memory: 24572kb
input:
300000 20089531 396414044 758180533 412465683 448315900 657579768 205740149 887463247 830864692 255081725 435254974 647642238 870638846 186032204 600184907 756644603 379354274 47441407 613202172 809149066 823653702 354479217 822061235 656075857 44216959 805765279 985247906 669950428 51667006 7886416...
output:
420126770 572958440 495515897 70230822 187655686 701687633 359213084 70638660 758335925 200386349 275768070 471046478 906448937 355768171 845537027 137550918 224127555 946830715 639583222 546346635 526818089 572482989 364339870 800733064 484251431 400696408 267406483 388278494 262471705 383175770 58...
result:
ok single line: '420126770 572958440 495515897 ...7 848784345 527298268 355063109'
Test #17:
score: 0
Accepted
time: 628ms
memory: 23968kb
input:
300000 562977356 71711295 451363154 326058858 583466483 820592517 681883247 144917863 124003646 510350656 661558636 971379840 840779332 181926416 509928496 519261784 683138627 442788324 19488632 507141568 425347554 984748789 920373652 617608538 97992820 506192132 759108858 972356632 97074662 6366733...
output:
507141568 442788324 659526083 971379840 124003646 510350656 519261784 71711295 159585860 673380817 812327266 509928496 243230654 824780133 999140222 884110120 920373652 669194248 717126831 225529895 759108858 583466483 614529900 53269355 389719542 936301069 241017168 681883247 423477653 95740227 957...
result:
ok single line: '507141568 442788324 659526083 ...5 311533381 181533346 292173134'
Test #18:
score: 0
Accepted
time: 594ms
memory: 24516kb
input:
300000 596314327 590358283 803106775 463578972 122707857 876454021 228392317 918253481 677670013 731007244 603355729 384838669 350906481 45836096 935804912 88580642 392583954 207911178 978621494 626524351 608940914 6593498 30417644 55134511 595156655 758552825 703303478 745286706 805351685 87655567 ...
output:
967341035 249231517 956054305 858796139 204983822 766954179 221430593 224397132 649763762 561284101 550948859 839582296 547154118 73586968 587346931 959716723 662406546 989657649 385888202 342745996 349062792 797069289 470343476 7326776 865666658 888343999 578701919 883389680 80505630 865830599 3289...
result:
ok single line: '967341035 249231517 956054305 ...1 540802756 752527922 714362712'
Test #19:
score: 0
Accepted
time: 53ms
memory: 9168kb
input:
300000 2 2 2 2 1 1 2 2 2 2 1 2 2 1 2 2 1 1 1 1 1 2 2 1 2 1 2 2 2 2 2 1 1 1 1 1 2 2 2 1 1 2 1 2 2 1 2 1 2 1 1 2 1 2 1 2 1 1 2 2 2 2 1 2 1 2 1 1 1 2 2 2 2 2 1 1 1 2 1 2 2 1 1 1 2 2 1 1 1 1 1 1 1 2 1 2 2 2 2 1 2 2 2 2 1 1 2 1 1 1 2 2 2 2 2 1 1 1 2 2 1 2 2 1 1 1 1 1 2 1 1 1 1 2 2 2 1 1 1 1 1 1 2 1 2 2 2...
output:
1 2 2 1 1 1 2 1 1 2 1 1 1 1 2 2 1 2 1 1 2 2 1 2 1 1 1 2 2 2 2 1 2 2 2 1 1 2 1 1 1 1 1 2 1 2 2 1 2 2 1 1 1 2 1 1 2 1 2 2 1 2 2 2 2 2 1 1 1 2 1 1 1 1 1 1 2 1 2 1 1 1 2 2 2 1 2 2 2 2 1 2 1 2 1 1 2 2 2 1 2 2 2 2 1 2 2 1 2 1 2 1 2 1 2 2 2 1 1 2 2 1 2 2 1 2 1 2 1 2 1 2 # 1 # 2 # 2 # 2 # 2 2 1 2 1 1 2 1 1 ...
result:
ok single line: '1 2 2 1 1 1 2 1 1 2 1 1 1 1 2 ...2 2 1 1 2 2 2 # 2 1 1 2 2 2 1 1'