# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
346833 | arnold518 | Table Tennis (info1cup20_tabletennis) | C++14 | 1483 ms | 16496 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 15e4+400;
const int MAXK = 400;
const int MOD = 3000000+1;
int N, K, A[MAXN+10];
int B[MOD+10];
int main()
{
scanf("%d%d", &N, &K);
for(int i=1; i<=N+K; i++) scanf("%d", &A[i]);
int tt=-1;
for(int i=1; i<=N+K; i++)
{
int t=N+K-i+1;
for(int j=max(i+1, t-K); j<=min(N+K, t+K); j++)
{
B[(A[i]+A[j])%MOD]+=2;
if(B[(A[i]+A[j])%MOD]>=N)
{
tt=(A[i]+A[j])%MOD;
break;
}
}
if(tt!=-1) break;
}
vector<int> V;
for(int i=1; i<=N+K; i++)
{
int t=N+K-i+1;
for(int j=max(i+1, t-K); j<=min(N+K, t+K); j++)
{
if((A[i]+A[j])%MOD==tt)
{
V.push_back(A[i]);
V.push_back(A[j]);
}
if(V.size()>=N) break;
}
if(V.size()>=N) break;
}
sort(V.begin(), V.end());
for(auto it : V) printf("%d ", it);
printf("\n");
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |