# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
667622 | joaof | Table Tennis (info1cup20_tabletennis) | C++14 | 3070 ms | 42248 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, k, v[MAX];
map<int, int> m;
bool teste(int a, int b){
int sum = v[a + 1] + v[n + k - b], mark[MAX], qtd = a + b;
for(int i = 1; i <= n + k; i++){
m[v[i]]++;
mark[i] = 0;
if(i <= a || i >= n + k + 1- b) mark[i] = 1;
}
for(int i = a + 1; i <= n + k - b; i++){
if(m[sum - v[i]] != 0){
m[sum - v[i]]--;
}
else{
mark[i] = 1;
qtd++;
}
}
if(qtd == k){
for(int i = 1; i <= n + k; i++){
if(mark[i]) continue;
printf("%d ", v[i]);
}
return true;
}
return false;
}
int main(){
scanf("%d %d", &n, &k);
for(int i = 1; i <= n + k; i++){
scanf("%d", &v[i]);
}
for(int i = 0; i <= k; i++){
for(int j = 0; j <= k - i; j++){
if(teste(i, j)) return 0;
}
}
}
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... |