# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
791055 | 2023-07-23T11:28:19 Z | Andrey | Table Tennis (info1cup20_tabletennis) | C++14 | 131 ms | 4504 KB |
#include <bits/stdc++.h> using namespace std; int n,k; vector<int> ans(0); vector<int> haha(0); bool check(int a) { ans.clear(); int l = 0,r = n+k-1; while(l < r) { while(r > l && haha[l]+haha[r] > a) { r--; } if(r <= l) { return false; } if(haha[r]+haha[l] == a) { ans.push_back(haha[l]); ans.push_back(haha[r]); if(ans.size() == n) { return true; } } l++; } return false; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n >> k; int a; for(int i = 0; i < n+k; i++) { cin >> a; haha.push_back(a); } for(int i = 0; i < k; i++) { for(int j = n+k-1; j >= n && j > i; j--) { if(check(haha[i]+haha[j])) { sort(ans.begin(),ans.end()); for(int y = 0; y < n; y++) { cout << ans[y] << " "; } return 0; } } } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 340 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 968 KB | Output is correct |
2 | Incorrect | 12 ms | 2900 KB | Unexpected end of file - int32 expected |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 27 ms | 4504 KB | Output is correct |
2 | Incorrect | 13 ms | 2896 KB | Unexpected end of file - int32 expected |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 320 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 131 ms | 212 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |