# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
523000 | 2022-02-06T18:30:41 Z | Farhan_HY | Table Tennis (info1cup20_tabletennis) | C++14 | 90 ms | 4396 KB |
#include <bits/stdc++.h> #define int long long #define float double #define pb push_back #define F first #define S second #define T int t; cin >> t; while(t--) #define IOS ios::sync_with_stdio(); cin.tie(0); cout.tie(0); using namespace std; const int inf = 8e18; const int N = 1e6 + 6; const int M = 1e3 + 3; const int mod = 1e9 + 7; const float pi = atan(1) * 4; int a[N]; int n, m; set<int> st; main() { cin >> n >> m; n += m; for(int i = 0; i < n; i++) cin >> a[i]; int l = 0, r = n - 1; if (m == 1) { st.insert(a[l] + a[r]); st.insert(a[l + 1] + a[r]); st.insert(a[l] + a[r - 1]); } else if (m == 2) { st.insert(a[l] + a[r]); st.insert(a[l + 1] + a[r]); st.insert(a[l] + a[r - 1]); st.insert(a[l] + a[r - 2]); st.insert(a[l + 1] + a[r - 1]); st.insert(a[l + 2] + a[r]); } int ans = 0; for(auto x: st) { l = 0, r = n - 1; bool ok = true; int cnt = 0; ans = 0; while(l < r) { if (a[l] + a[r] == x) { l++; r--; continue; } if (l != n - 1 && a[l + 1] + a[r] == x && l + 1 != r) { cnt++; ans = l; l += 2; r--; continue; } if (r != 0 && a[l] + a[r - 1] == x && l != r - 1) { cnt++; ans = r; r -= 2; l++; continue; } ok = false; l++, r--; } if (ok && cnt <= 1) break; } int cnt = 0; for(int i = 0; i < n; i++) { if (cnt == n - m) break; if (i != ans) cout << a[i] << ' ', cnt++; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 2 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 584 KB | Output is correct |
2 | Correct | 90 ms | 2888 KB | Output is correct |
3 | Correct | 67 ms | 2836 KB | Output is correct |
4 | Correct | 70 ms | 2856 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 64 ms | 2920 KB | Output is correct |
2 | Incorrect | 66 ms | 4396 KB | Output does not have symmetry property |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output does not have symmetry property |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output does not have symmetry property |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Output does not have symmetry property |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output does not have symmetry property |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output does not have symmetry property |
2 | Halted | 0 ms | 0 KB | - |