# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
717345 | 2023-04-01T21:14:52 Z | vjudge1 | Table Tennis (info1cup20_tabletennis) | C++17 | 94 ms | 13484 KB |
#include <bits/stdc++.h> using namespace std; #define all(x) x.begin(),x.end() #define int long long const int sz = 4e5 + 5; const int mod = 1e9 + 7; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m; cin >> n >> m; vector<int>v(n + m); map<int, int>mp; for (int i = 0; i < n + m; i++) { cin >> v[i]; mp[v[i]] = i + 1; } sort(all(v)); vector<int>ans; vector<int>a, b; int l = 0, r = n - 1; int x = 0; while (l < r) { if (x % 2 == 0) { a.push_back(v[l]); a.push_back(v[r]); } else { b.push_back(v[l]); b.push_back(v[r]); } l++; r--; x++; } int sum1 = 0, sum2 = 0; for (auto i : a) { sum1 += i; } for (auto i : b) { sum2 += i; } if (sum1 == sum2) { for (int i = 0; i < n; i++)cout << mp[v[i]] << ' '; } else { int x = sum1 - sum2; for (int i = 0; i < a.size();i++) { if (v[n] - a[i] == -x) { a[i] = v[n]; x = 0; } } for (int i = 0; i < b.size(); i++) { if (v[n] - b[i] == x) { b[i] = v[n]; x = 0; } } for (auto i : a)cout << mp[i] << ' '; for (auto i : b)cout << mp[i] << ' '; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 468 KB | Output not sorted |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 2260 KB | Output not sorted |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 94 ms | 13484 KB | Output not sorted |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output not subsequence of input |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output not sorted |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output not sorted |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output not sorted |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 340 KB | Output not sorted |
2 | Halted | 0 ms | 0 KB | - |