# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
667584 | joaof | Table Tennis (info1cup20_tabletennis) | C++14 | 163 ms | 23468 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>
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(), x.end()
#define bug(x) cerr << #x << ": " << x << endl
using namespace std;
using ll = long long;
const int MAX = 15e4 + 10;
int n, v[MAX], sum, k;
map<int, int> m;
bool fake[MAX];
void sol1(){
int qtd = 0, err = 0;
sum = v[1] + v[n + k];
for(int i = 1; i <= n + k; i++){
if(m[sum - v[i]] != 0){
m[sum - v[i]]--;
}
else{
qtd++;
if(qtd == 1) err = i;
}
}
if(qtd == 1){
for(int i = 1; i <= n + k; i++){
if(i != err){
printf("%d ", v[i]);
}
}
}
for(int i = 1; i <= n + k; i++){
m[v[i]]++;
}
qtd = 0, err = 0;
sum = v[2] + v[n + k];
for(int i = 1; i <= n + k; i++){
if(m[sum - v[i]] != 0){
m[sum - v[i]]--;
}
else{
qtd++;
if(qtd == 1) err = i;
}
}
if(qtd == 1){
for(int i = 1; i <= n + k; i++){
if(i != err){
printf("%d ", v[i]);
}
}
}
for(int i = 1; i <= n + k; i++){
m[v[i]]++;
}
qtd = 0, err = 0;
sum = v[1] + v[n + k - 1];
for(int i = 1; i <= n + k; i++){
if(m[sum - v[i]] != 0){
m[sum - v[i]]--;
}
else{
qtd++;
if(qtd == 1) err = i;
}
}
if(qtd == 1){
for(int i = 1; i <= n + k; i++){
if(i != err){
printf("%d ", v[i]);
}
}
}
}
int main(){
scanf("%d %d", &n, &k);
for(int i = 1; i <= n + k; i++){
scanf("%d", &v[i]);
m[v[i]]++;
}
if(k == 1){
sol1();
}
}
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... |