# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
442685 | JovanB | Table Tennis (info1cup20_tabletennis) | C++17 | 169 ms | 4556 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>
using namespace std;
using ll = long long;
using ld = long double;
const int MAXN = 200000;
int a[MAXN+5];
int main(){
ios_base::sync_with_stdio(false), cin.tie(0);
cout.precision(10);
cout << fixed;
int n, k;
cin >> n >> k;
vector <int> vec;
for(int i=1; i<=n+k; i++){
cin >> a[i];
}
for(int ls=1; ls<=k+1; ls++){
for(int rs=n+k; rs>=n; rs--){
int sum = a[ls] + a[rs];
vec.clear();
vec.push_back(a[ls]);
vec.push_back(a[rs]);
int j = rs;
for(int i=ls+1; i<=rs; i++){
if(vec.size() + (j-i+1) < n) break;
if(a[i] >= sum - a[i]) break;
if(vec.size() == n) break;
while(j > i && a[i] + a[j] > sum) j--;
if(a[i] + a[j] == sum){
vec.push_back(a[i]);
vec.push_back(a[j]);
}
}
if(vec.size() == n){
sort(vec.begin(), vec.end());
for(auto c : vec) cout << c << " ";
cout << "\n";
return 0;
}
}
}
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... |