QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#106073 | #4746. Table Tennis | Kostlin | 72 | 85ms | 9888kb | C++14 | 1.9kb | 2023-05-16 11:58:53 | 2023-05-16 11:58:57 |
Judging History
answer
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <unordered_map>
using namespace std;
#define fi first
#define sc second
#define mkp make_pair
#define pii pair<int,int>
#define pll pair<ll,int>
typedef long long ll;
const int N=2e5+5,K=505,oo=1e9,mod=998244353;
inline int read() {
int x=0,flag=0;char ch=getchar();
while(ch<'0'||ch>'9') {flag|=(ch=='-');ch=getchar();}
while('0'<=ch&&ch<='9') {x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
return flag?-x:x;
}
inline int mx(int x,int y) {return x>y?x:y;}
inline int mn(int x,int y) {return x<y?x:y;}
inline void swp(int &x,int &y) {x^=y^=x^=y;}
inline int as(int x) {return x>0?x:-x;}
inline void add(int&x,int y) {x=(x+y>=mod?x+y-mod:x+y);}
unordered_map<int,int>mp,Mp;
int n,k,a[N],qwq[K<<2]; bool vis[N];
int main() {
n=read();k=read();
for(int i=1;i<=n+k;++i) a[i]=read(),Mp[a[i]]=i;
if(n<=2*k) {
for(int i=1;i<=k+1;++i)
for(int j=n;j<=n+k;++j)
qwq[++qwq[0]]=a[i]+a[j];
sort(qwq+1,qwq+qwq[0]+1); qwq[0]=unique(qwq+1,qwq+qwq[0]+1)-qwq-1;
} else {
for(int i=1;i<=2*k;++i)
for(int j=n+k-2*k+1;j<=n+k;++j)
++mp[a[i]+a[j]];
for(auto&V:mp)
if(V.sc>=k)
qwq[++qwq[0]]=V.fi;
}
for(int i=1;i<=qwq[0];++i) {
int sum=0;
for(int j=1;j<=n+k;++j)
if(a[j]<(qwq[i]-1)/2+1&&Mp.count(qwq[i]-a[j]))
++sum;
if(sum>=n/2) {
sum=0;
for(int j=1;j<=n+k;++j)
if(a[j]<(qwq[i]-1)/2+1&&Mp.count(qwq[i]-a[j])) {
vis[j]=1,vis[Mp[qwq[i]-a[j]]]=1;
++sum;
if(sum==n/2) break;
}
break;
}
}
for(int i=1;i<=n+k;++i)
if(vis[i]) printf("%d ",a[i]);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 11
Accepted
Test #1:
score: 11
Accepted
time: 0ms
memory: 3628kb
input:
2000 1 395836858 395837506 395838960 395840414 395841868 395843322 395844776 395846230 395847684 395849138 395850592 395852046 395853500 395854954 395856408 395857862 395859316 395860770 395862224 395863678 395865132 395866586 395868040 395869494 395870948 395872402 395873856 395875310 395876764 395...
output:
395837506 395838960 395840414 395841868 395843322 395844776 395846230 395847684 395849138 395850592 395852046 395853500 395854954 395856408 395857862 395859316 395860770 395862224 395863678 395865132 395866586 395868040 395869494 395870948 395872402 395873856 395875310 395876764 395878218 395879672 ...
result:
ok correct
Test #2:
score: 0
Accepted
time: 3ms
memory: 3608kb
input:
2000 1 100293569 100296110 100300260 100306391 100312872 100318802 100319394 100322014 100328723 100335099 100338217 100342460 100348894 100350515 100352136 100358256 100363404 100365148 100371659 100371856 100375751 100379646 100385749 100387938 100391544 100393522 100394973 100396424 100403159 100...
output:
100293569 100296110 100300260 100306391 100312872 100318802 100319394 100322014 100328723 100335099 100338217 100342460 100348894 100350515 100352136 100358256 100363404 100365148 100371659 100371856 100375751 100379646 100385749 100387938 100391544 100393522 100394973 100396424 100403159 100403866 ...
result:
ok correct
Test #3:
score: 0
Accepted
time: 2ms
memory: 3708kb
input:
2000 1 38654500 38659254 38664008 38668762 38673516 38678270 38683024 38687778 38692532 38697286 38702040 38706794 38711548 38716302 38721056 38725810 38730564 38735318 38740072 38744826 38749580 38754334 38759088 38763842 38768596 38773350 38778104 38782858 38787612 38792366 38797120 38801874 38806...
output:
38654500 38659254 38664008 38668762 38673516 38678270 38683024 38687778 38692532 38697286 38702040 38706794 38711548 38716302 38721056 38725810 38730564 38735318 38740072 38744826 38749580 38754334 38759088 38763842 38768596 38773350 38778104 38782858 38787612 38792366 38797120 38801874 38806628 388...
result:
ok correct
Subtask #2:
score: 9
Accepted
Dependency #1:
100%
Accepted
Test #4:
score: 9
Accepted
time: 6ms
memory: 4240kb
input:
20000 1 551234 571234 591234 611234 631234 651234 671234 691234 711234 731234 751234 771234 791234 811234 831234 851234 871234 891234 911234 931234 951234 971234 991234 1011234 1031234 1051234 1071234 1091234 1111234 1131234 1151234 1171234 1191234 1211234 1231234 1251234 1271234 1291234 1311234 133...
output:
551234 571234 591234 611234 631234 651234 671234 691234 711234 731234 751234 771234 791234 811234 831234 851234 871234 891234 911234 931234 951234 971234 991234 1011234 1031234 1051234 1071234 1091234 1111234 1131234 1151234 1171234 1191234 1211234 1231234 1251234 1271234 1291234 1311234 1331234 135...
result:
ok correct
Test #5:
score: 0
Accepted
time: 41ms
memory: 9776kb
input:
150000 1 358398573 358398627 358402117 358405607 358409097 358412587 358416077 358419567 358423057 358426547 358430037 358433527 358437017 358440507 358443997 358447487 358450977 358454467 358457957 358461447 358464937 358468427 358471917 358475407 358478897 358482387 358485877 358489367 358492857 3...
output:
358398627 358402117 358405607 358409097 358412587 358416077 358419567 358423057 358426547 358430037 358433527 358437017 358440507 358443997 358447487 358450977 358454467 358457957 358461447 358464937 358468427 358471917 358475407 358478897 358482387 358485877 358489367 358492857 358496347 358499837 ...
result:
ok correct
Test #6:
score: 0
Accepted
time: 51ms
memory: 9792kb
input:
150000 1 178954914 178956794 178958674 178960554 178962434 178964314 178966194 178968074 178969954 178971834 178973714 178975594 178977474 178979354 178981234 178983114 178984994 178986874 178988754 178990634 178992514 178994394 178996274 178998154 179000034 179001914 179003794 179005674 179007554 1...
output:
178954914 178956794 178958674 178960554 178962434 178964314 178966194 178968074 178969954 178971834 178973714 178975594 178977474 178979354 178981234 178983114 178984994 178986874 178988754 178990634 178992514 178994394 178996274 178998154 179000034 179001914 179003794 179005674 179007554 179009434 ...
result:
ok correct
Test #7:
score: 0
Accepted
time: 47ms
memory: 9776kb
input:
150000 1 77769196 77771516 77773836 77776156 77778476 77780796 77783116 77785436 77787756 77790076 77792396 77794716 77797036 77799356 77801676 77803996 77806316 77808636 77810956 77813276 77815596 77817916 77820236 77822556 77824876 77827196 77829516 77831836 77834156 77836476 77838796 77841116 778...
output:
77769196 77771516 77773836 77776156 77778476 77780796 77783116 77785436 77787756 77790076 77792396 77794716 77797036 77799356 77801676 77803996 77806316 77808636 77810956 77813276 77815596 77817916 77820236 77822556 77824876 77827196 77829516 77831836 77834156 77836476 77838796 77841116 77843436 778...
result:
ok correct
Subtask #3:
score: 14
Accepted
Test #8:
score: 14
Accepted
time: 49ms
memory: 9872kb
input:
150000 2 136218406 136221656 136224207 136225416 136231231 136237572 136243400 136249042 136249370 136249698 136250026 136250354 136257303 136260078 136262853 136263674 136264599 136268888 136272942 136278492 136283798 136286694 136292868 136293494 136300331 136304395 136306105 136307334 136308563 1...
output:
136224207 136225416 136231231 136237572 136243400 136249042 136249370 136249698 136250026 136250354 136257303 136260078 136262853 136263674 136264599 136268888 136272942 136278492 136283798 136286694 136292868 136293494 136300331 136304395 136306105 136307334 136308563 136315312 136319767 136325444 ...
result:
ok correct
Test #9:
score: 0
Accepted
time: 48ms
memory: 9820kb
input:
150000 2 22981423 22986125 22990827 22995529 23000231 23004933 23009635 23014337 23019039 23023741 23028443 23033145 23037847 23042549 23047251 23051953 23056655 23061357 23066059 23070761 23075463 23080165 23084867 23089569 23094271 23098973 23103675 23108377 23113079 23117781 23122483 23127185 231...
output:
22981423 22986125 22990827 22995529 23000231 23004933 23009635 23014337 23019039 23023741 23028443 23033145 23037847 23042549 23047251 23051953 23056655 23061357 23066059 23070761 23075463 23080165 23084867 23089569 23094271 23098973 23103675 23108377 23113079 23117781 23122483 23127185 23131887 231...
result:
ok correct
Test #10:
score: 0
Accepted
time: 54ms
memory: 9888kb
input:
150000 2 41308780 41312836 41316669 41319720 41323806 41327538 41330860 41334182 41341021 41345698 41347991 41354910 41357635 41361887 41366139 41371942 41376540 41381138 41383586 41386682 41389964 41393246 41396528 41403501 41409981 41410709 41414393 41417187 41419270 41425309 41431348 41435549 414...
output:
41312836 41316669 41319720 41323806 41327538 41330860 41334182 41341021 41345698 41347991 41354910 41357635 41361887 41366139 41371942 41376540 41381138 41383586 41386682 41389964 41393246 41396528 41403501 41409981 41410709 41414393 41417187 41419270 41425309 41431348 41435549 41438704 41443642 414...
result:
ok correct
Test #11:
score: 0
Accepted
time: 56ms
memory: 9788kb
input:
150000 2 64434729 64436698 64438667 64440636 64442605 64444574 64446543 64448512 64450481 64452450 64454419 64456388 64458357 64460326 64462295 64464264 64466233 64468202 64470171 64472140 64474109 64476078 64478047 64480016 64481985 64483954 64485923 64487892 64489861 64491830 64493799 64495768 644...
output:
64434729 64436698 64438667 64440636 64442605 64444574 64446543 64448512 64450481 64452450 64454419 64456388 64458357 64460326 64462295 64464264 64466233 64468202 64470171 64472140 64474109 64476078 64478047 64480016 64481985 64483954 64485923 64487892 64489861 64491830 64493799 64495768 64497737 644...
result:
ok correct
Subtask #4:
score: 9
Accepted
Test #12:
score: 9
Accepted
time: 2ms
memory: 3524kb
input:
14 4 217398598 217402651 217406704 217410757 217414810 217418863 217422916 217428108 217432161 217436214 217440267 217444320 217448373 217452426 245178479 391797826 782596022 958372373
output:
217398598 217402651 217406704 217410757 217414810 217418863 217422916 217428108 217432161 217436214 217440267 217444320 217448373 217452426
result:
ok correct
Test #13:
score: 0
Accepted
time: 1ms
memory: 3520kb
input:
10 8 5119220 5123069 5126918 5130767 5134616 5142801 5146650 5150499 5154348 5158197 154960511 297639141 501493882 533034093 754990704 808780135 992614663 998193478
output:
5119220 5123069 5126918 5130767 5134616 5142801 5146650 5150499 5154348 5158197
result:
ok correct
Test #14:
score: 0
Accepted
time: 1ms
memory: 3544kb
input:
6 12 36447689 36453729 36455136 36462048 36463455 36469495 47319297 72718784 183783201 243087884 255153623 321817029 375498891 509735326 620294220 682002282 739331617 980504843
output:
36447689 36453729 36455136 36462048 36463455 36469495
result:
ok correct
Test #15:
score: 0
Accepted
time: 2ms
memory: 3536kb
input:
6 4 1 10 100 1000 10001 10002 10003 10004 10005 10006
output:
10001 10002 10003 10004 10005 10006
result:
ok correct
Subtask #5:
score: 0
Wrong Answer
Dependency #4:
100%
Accepted
Test #16:
score: 0
Wrong Answer
time: 5ms
memory: 3440kb
input:
40 100 1036262 1042312 1048362 1054412 1060462 1066512 1072562 1078612 1084662 1090712 1096762 1102812 1108862 1114912 1120962 1127012 1133062 1139112 1145162 1151212 1153361 1159411 1165461 1171511 1177561 1183611 1189661 1195711 1201761 1207811 1213861 1219911 1225961 1232011 1238061 1244111 12501...
output:
result:
wrong output format Unexpected end of file - int32 expected
Subtask #6:
score: 14
Accepted
Dependency #1:
100%
Accepted
Dependency #4:
100%
Accepted
Test #23:
score: 14
Accepted
time: 1ms
memory: 3688kb
input:
2000 20 90436838 90437072 90437996 90438218 90438316 90438856 90438892 90439045 90439110 90439277 90439680 90439685 90440022 90440165 90440633 90446559 90452889 90453052 90453182 90453312 90453442 90458599 90459334 90461604 90467433 90469849 90475234 90480619 90482102 90483585 90486493 90488427 9049...
output:
90440633 90446559 90452889 90453052 90453182 90453312 90453442 90458599 90459334 90461604 90467433 90469849 90475234 90480619 90482102 90483585 90486493 90488427 90494255 90496349 90501062 90504729 90508055 90511631 90515207 90518195 90523957 90525152 90530761 90536370 90538488 90541690 90544194 905...
result:
ok correct
Test #24:
score: 0
Accepted
time: 2ms
memory: 3664kb
input:
2000 20 40413983 40419263 40424543 40429823 40435103 40440383 40445663 40450943 40456223 40461503 40466783 40472063 40477343 40482623 40487903 40493183 40498463 40503743 40509023 40514303 40519583 40524863 40530143 40535423 40540703 40545983 40551263 40556543 40561823 40567103 40572383 40577663 4058...
output:
40413983 40419263 40424543 40429823 40435103 40440383 40445663 40450943 40456223 40461503 40466783 40472063 40477343 40482623 40487903 40493183 40498463 40503743 40509023 40514303 40519583 40524863 40530143 40535423 40540703 40545983 40551263 40556543 40561823 40567103 40572383 40577663 40582943 405...
result:
ok correct
Test #25:
score: 0
Accepted
time: 2ms
memory: 3688kb
input:
2000 20 15717854 15720165 15720249 15720308 15720854 15721054 15722106 15723608 15729822 15736036 15742250 15748464 15754678 15760892 15767106 15773320 15779534 15785748 15791962 15798176 15804390 15810604 15816818 15823032 15829246 15835460 15841674 15847888 15854102 15860316 15866530 15872744 1587...
output:
15723608 15729822 15736036 15742250 15748464 15754678 15760892 15767106 15773320 15779534 15785748 15791962 15798176 15804390 15810604 15816818 15823032 15829246 15835460 15841674 15847888 15854102 15860316 15866530 15872744 15878958 15885172 15891386 15897600 15903814 15910028 15916242 15922456 159...
result:
ok correct
Test #26:
score: 0
Accepted
time: 1ms
memory: 3764kb
input:
2000 20 13709298 13709486 13710912 13716753 13722505 13724263 13727965 13730836 13736770 13741977 13745061 13750797 13753287 13753687 13758337 13765008 13765847 13767244 13772040 13778136 13784778 13787123 13791546 13797260 13798587 13805340 13810407 13815084 13821897 13828194 13831212 13835147 1383...
output:
13709298 13709486 13710912 13716753 13722505 13724263 13727965 13730836 13736770 13741977 13745061 13750797 13753287 13753687 13758337 13765008 13765847 13767244 13772040 13778136 13784778 13787123 13791546 13797260 13798587 13805340 13810407 13815084 13821897 13828194 13831212 13835147 13839015 138...
result:
ok correct
Test #27:
score: 0
Accepted
time: 3ms
memory: 3652kb
input:
2000 20 90579797 90589738 90599679 90609620 90619561 90629502 90639443 90649384 90659325 90669266 90679207 90689148 90699089 90709030 90718971 90728912 90738853 90748794 90758735 90768676 90778617 90788558 90798499 90808440 90818381 90828322 90838263 90848204 90858145 90868086 90878027 90887968 9089...
output:
90709030 90718971 90728912 90738853 90748794 90758735 90768676 90778617 90788558 90798499 90808440 90818381 90828322 90838263 90848204 90858145 90868086 90878027 90887968 90897909 90907850 90917791 90927732 90937673 90947614 90957555 90967496 90977437 90987378 90997319 91007260 91017201 91027142 910...
result:
ok correct
Subtask #7:
score: 15
Accepted
Dependency #2:
100%
Accepted
Dependency #6:
100%
Accepted
Test #28:
score: 15
Accepted
time: 85ms
memory: 9820kb
input:
150000 20 127687786 127688121 127688156 127688342 127688519 127688866 127688980 127689035 127689273 127689408 127689631 127690000 127690363 127690391 127690472 127693189 127695906 127698623 127701340 127704057 127706774 127709491 127712208 127714925 127717642 127720359 127723076 127725793 127728510 ...
output:
127690472 127693189 127695906 127698623 127701340 127704057 127706774 127709491 127712208 127714925 127717642 127720359 127723076 127725793 127728510 127731227 127733944 127736661 127739378 127742095 127744812 127747529 127750246 127752963 127755680 127758397 127761114 127763831 127766548 127769265 ...
result:
ok correct
Test #29:
score: 0
Accepted
time: 41ms
memory: 9776kb
input:
150000 20 7028123 7033034 7034241 7037633 7038229 7044942 7045213 7047750 7053672 7053752 7057083 7057266 7057449 7063104 7065286 7070129 7071250 7071449 7073383 7074244 7076907 7081728 7081829 7086012 7090542 7092330 7094440 7096946 7102440 7107993 7110439 7112653 7117223 7120577 7122550 7127620 71...
output:
7028123 7033034 7034241 7037633 7038229 7044942 7045213 7047750 7053672 7053752 7057083 7057266 7057449 7063104 7065286 7070129 7071250 7071449 7073383 7074244 7076907 7081728 7081829 7086012 7090542 7092330 7094440 7096946 7102440 7107993 7110439 7112653 7117223 7120577 7122550 7127620 7131042 7135...
result:
ok correct
Test #30:
score: 0
Accepted
time: 39ms
memory: 9788kb
input:
150000 20 64281223 64281226 64281328 64282448 64284146 64284310 64284507 64285230 64290971 64293764 64296317 64300026 64304796 64310792 64314337 64316877 64323514 64328583 64334846 64336803 64338760 64341563 64344366 64349299 64354232 64356835 64358883 64362051 64364596 64368163 64370585 64373007 64...
output:
64285230 64290971 64293764 64296317 64300026 64304796 64310792 64314337 64316877 64323514 64328583 64334846 64336803 64338760 64341563 64344366 64349299 64354232 64356835 64358883 64362051 64364596 64368163 64370585 64373007 64375085 64376867 64383191 64386627 64391911 64393710 64395444 64396265 643...
result:
ok correct
Test #31:
score: 0
Accepted
time: 50ms
memory: 9872kb
input:
150000 20 11724274 11726538 11728802 11731066 11733330 11735594 11737858 11740122 11742386 11744650 11746914 11749178 11751442 11753706 11755970 11758234 11760498 11762762 11765026 11767290 11769554 11771818 11774082 11776346 11778610 11780874 11783138 11785402 11787666 11789930 11792194 11794458 11...
output:
11724274 11726538 11728802 11731066 11733330 11735594 11737858 11740122 11742386 11744650 11746914 11749178 11751442 11753706 11755970 11758234 11760498 11762762 11765026 11767290 11769554 11771818 11774082 11776346 11778610 11780874 11783138 11785402 11787666 11789930 11792194 11794458 11796722 117...
result:
ok correct
Test #32:
score: 0
Accepted
time: 20ms
memory: 9816kb
input:
150000 20 554188 250112236 275238278 623402596 623402658 623402720 623402782 623402844 623402906 623402968 623403030 623403092 623403154 623403216 623403278 623403340 623403402 623403464 623403526 623403588 623403650 623403712 623403774 623403836 623403898 623403960 623404022 623404084 623404146 623...
output:
623403278 623403340 623403402 623403464 623403526 623403588 623403650 623403712 623403774 623403836 623403898 623403960 623404022 623404084 623404146 623404208 623404270 623404332 623404394 623404456 623404518 623404580 623404642 623404704 623404766 623404828 623404890 623404952 623405014 623405076 ...
result:
ok correct
Test #33:
score: 0
Accepted
time: 41ms
memory: 9772kb
input:
150000 20 40337033 40337087 40337175 40337195 40337528 40337657 40337726 40337822 40343224 40344226 40345814 40351492 40353264 40354903 40360603 40360868 40363614 40367774 40368123 40368276 40368429 40368582 40371771 40371875 40373376 40378198 40378496 40378794 40378838 40385670 40392668 40397075 40...
output:
40337822 40343224 40344226 40345814 40351492 40353264 40354903 40360603 40360868 40363614 40367774 40368123 40368276 40368429 40368582 40371771 40371875 40373376 40378198 40378496 40378794 40378838 40385670 40392668 40397075 40400129 40403631 40407133 40412378 40412487 40417109 40421668 40427736 404...
result:
ok correct
Test #34:
score: 0
Accepted
time: 47ms
memory: 9788kb
input:
150000 20 2883933 2884539 2884773 2885504 2886097 2887181 2887572 2889328 2889957 2890852 2893829 2896806 2899783 2903505 2908229 2912213 2914213 2914987 2918009 2921031 2926428 2928983 2935572 2937357 2943848 2948102 2948960 2950356 2956582 2956974 2963018 2965541 2967152 2972027 2976902 2981000 29...
output:
2883933 2889957 2890852 2893829 2896806 2899783 2903505 2908229 2912213 2914213 2914987 2918009 2921031 2926428 2928983 2935572 2937357 2943848 2948102 2948960 2950356 2956582 2956974 2963018 2965541 2967152 2972027 2976902 2981000 2983747 2986494 2988082 2989670 2996057 3001055 3004931 3011854 3013...
result:
ok correct
Subtask #8:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Dependency #5:
0%