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;
using ll = long long;
bool check(vector<ll> a){
int n = a.size();
ll k = a[0] + a.back();
for (int i = 1; i < n - i - 1; i++){
if (a[i] + a[n - i - 1] != k){
return false;
}
}
return true;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, k; cin>>n>>k;
vector<ll> a(n + k);
for (int i = 0; i < n + k; i++){
cin>>a[i];
}
if (n <= 100 && k <= 100){
for (int i = 0; i < k; i++){
vector<ll> b;
for (int j = 0; j < n; j++){
b.push_back(a[i + j]);
}
if (check(b)){
for (int j: b){
cout<<j<<" ";
}
return 0;
}
}
}
else {
for (int i = 0; i < n + k; i++){
vector<ll> b = a;
b.erase(b.begin() + i);
if (check(b)){
for (int j = 0; j < n; j++){
cout<<b[j]<<" ";
}
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... |