| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 423616 | errorgorn | Table Tennis (info1cup20_tabletennis) | C++17 | 3081 ms | 80652 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;
#define ll long long
#define ii pair<ll,ll>
#define fi first
#define se second
#define endl '\n'
#define puf push_front
#define pof pop_front
#define pub push_back
#define pob pop_back
#define rep(x,s,e) for (auto x=s-(s>e);x!=e-(s>e);s<e?x++:x--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n,k;
int arr[160005];
unordered_map<int,int> m;
int main(){
cin.tie(0);
cout.tie(0);
cin.sync_with_stdio(false);
cin>>n>>k;
rep(x,0,n+k) cin>>arr[x];
int l=n,r=n+k;
rep(x,0,n){
l--,r--;
if (r<x) break;
rep(y,max(x+1,l),r+1){
m[arr[x]+arr[y]]++;
}
}
int val;
for (auto &it:m){
if (it.se>=n/2) val=it.fi;
}
vector<int> ans;
r=n+k-1;
rep(x,0,n){
while (arr[x]+arr[r]>val) r--;
if (arr[x]+arr[r]==val){
ans.pub(arr[x]);
ans.pub(arr[r]);
r--;
if (sz(ans)==n) break;
}
}
sort(all(ans));
for (auto &it:ans) cout<<it<<" "; cout<<endl;
}
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... | ||||
