# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1134778 | milutin | Table Tennis (info1cup20_tabletennis) | C++20 | 1492 ms | 1114112 KiB |
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
int main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL);
int n, k;
cin >> n >> k;
vector<int> b(n+k);
for(int i=0; i<n+k; i++){
cin >> b[i];
}
if(k==1 && n<=2000){
for(int i=0; i<n+k; i++){
int l=0;
int r=n;
int currSt = -1;
bool f=true;
while(l<r){
if(l==i){
l++;
}
else if(r==i){
r--;
}
if(currSt==-1){
currSt = b[l]+b[r];
}
else{
if((b[l]+b[r])!=currSt){
f = false;
break;
}
}
l++;
r--;
}
if(f){
for(int j=0; j<n+k; j++){
if(j!=i){
cout << b[j] << " ";
}
}
return 0;
}
}
}
else if(k==1){
int l=0;
int r=n+k-1;
map<int, vector<int>> m;
while(l<r){
m[b[l]+b[r]].push_back(l);
}
if(m.size()==1){
for(int i=0; i<n+k; i++){
if(i!=(n+k)/2){
cout << b[i] << " ";
}
}
}
if(m.size() == 2){
int i=0;
int l=0;
int r=n;
int currSt = -1;
bool f=true;
while(l<r){
if(l==i){
l++;
}
else if(r==i){
r--;
}
if(currSt==-1){
currSt = b[l]+b[r];
}
else{
if((b[l]+b[r])!=currSt){
f = false;
break;
}
}
l++;
r--;
}
if(f){
for(int j=0; j<n+k; j++){
if(j!=i){
cout << b[j] << " ";
}
}
return 0;
}
i=n+k-1;
l=0;
r=n;
currSt = -1;
f=true;
while(l<r){
if(l==i){
l++;
}
else if(r==i){
r--;
}
if(currSt==-1){
currSt = b[l]+b[r];
}
else{
if((b[l]+b[r])!=currSt){
f = false;
break;
}
}
l++;
r--;
}
if(f){
for(int j=0; j<n+k; j++){
if(j!=i){
cout << b[j] << " ";
}
}
return 0;
}
}
else if(m.size()==3){
int r=n+k-1;
int l=0;
int currSt = b[l]+b[r];
r--;
l++;
int ind=-1;
while(l<r){
if(b[l]+b[r]!=currSt){
ind = l;
break;
}
}
int i=ind;
l=0;
r=n;
currSt = -1;
bool f=true;
while(l<r){
if(l==i){
l++;
}
else if(r==i){
r--;
}
if(currSt==-1){
currSt = b[l]+b[r];
}
else{
if((b[l]+b[r])!=currSt){
f = false;
break;
}
}
l++;
r--;
}
if(f){
for(int j=0; j<n+k; j++){
if(j!=i){
cout << b[j] << " ";
}
}
return 0;
}
i=n+k-ind-1;
l=0;
r=n;
currSt = -1;
f=true;
while(l<r){
if(l==i){
l++;
}
else if(r==i){
r--;
}
if(currSt==-1){
currSt = b[l]+b[r];
}
else{
if((b[l]+b[r])!=currSt){
f = false;
break;
}
}
l++;
r--;
}
if(f){
for(int j=0; j<n+k; j++){
if(j!=i){
cout << b[j] << " ";
}
}
return 0;
}
}
}
else{
cout << "I be licking that dude braids like ;p" << endl;
}
}
# | 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... |