QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#106072 | #4746. Table Tennis | Kostlin | 34 | 63ms | 9876kb | C++14 | 1.9kb | 2023-05-16 11:57:25 | 2023-05-16 11:57:28 |
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]/2&&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]/2&&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: 2ms
memory: 3700kb
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: 3684kb
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: 0ms
memory: 3688kb
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: 7ms
memory: 4340kb
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: 52ms
memory: 9792kb
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: 59ms
memory: 9776kb
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: 63ms
memory: 9824kb
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: 31ms
memory: 9836kb
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: 54ms
memory: 9872kb
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: 52ms
memory: 9776kb
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: 51ms
memory: 9876kb
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: 0
Wrong Answer
Test #12:
score: 9
Accepted
time: 0ms
memory: 3528kb
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: 2ms
memory: 3484kb
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: 3596kb
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: -9
Wrong Answer
time: 2ms
memory: 3336kb
input:
6 4 1 10 100 1000 10001 10002 10003 10004 10005 10006
output:
result:
wrong output format Unexpected end of file - int32 expected
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #4:
0%
Subtask #7:
score: 0
Skipped
Dependency #2:
100%
Accepted
Dependency #6:
0%
Subtask #8:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
0%