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>
#define int long long
using namespace std;
const int MAXN = 15e4 + 10;
int atual[MAXN];
int v[MAXN];
int resp[MAXN];
bool FoundResp = false;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int N, K;
cin >> N >> K;
for (int i = 1; i <= N + K; i++) cin >> v[i];
if (K == 1)
{
for (int fora = 1; fora <= N + K; fora++)
{
int p = 1; int q = N + K;
if (fora == 1) p++;
if (fora == N + K) q--;
int med = v[p] + v[q];
bool funciona = true;
while (p < q)
{
if (v[p] + v[q] != med)
{
funciona = false;
break;
}
p++;
q--;
}
// cerr << fora << " " << med << '\n';
if (funciona)
{
for (int i = 1; i <= N + K; i++)
{
if (i == fora) continue;
cout << v[i] << " ";
}
return 0;
}
}
}
else
{
int l = 1; int r = N;
while (r <= N + K)
{
int p = l; int q = r;
//if (fora == 1) p++;
//if (fora == N + K) q--;
int med = v[p] + v[q];
bool funciona = true;
while (p < q)
{
if (v[p] + v[q] != med)
{
funciona = false;
break;
}
p++;
q--;
}
// cerr << fora << " " << med << '\n';
if (funciona)
{
for (int i = l; i <= r; i++)
{
cout << v[i] << " ";
}
return 0;
}
}
}
}
# | 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... |