# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
683519 | JooDdae | Table Tennis (info1cup20_tabletennis) | C++17 | 68 ms | 5820 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;
int n, k, a[200200];
int main(){
cin.tie(0)->sync_with_stdio(0);
cin >> n >> k;
for(int i=1;i<=n+k;i++) cin >> a[i];
map<int, int> mp;
for(int A=0;A<=2*k;A++) for(int B=0;B<=2*k;B++) {
int L = A+1, R = n+k-B;
mp[a[L] + a[R]]++;
}
for(auto [S, c] : mp) if(5*k >= n || c >= k/2) {
int l = 1, r = n+k;
vector<array<int, 2>> v;
while(l < r && v.size()+(r-l+1)/2 >= n/2) {
if(a[l] + a[r] == S) {
v.push_back({l, r});
l++, r--;
continue;
}
if(S-a[l] > a[r]) l++;
else r--;
}
if(v.size() >= n/2) {
for(int i=0;i<n/2;i++) cout << v[i][0] << " ";
for(int i=n/2-1;i>=0;i--) cout << v[i][1] << " ";
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... |