Submission #555833

#TimeUsernameProblemLanguageResultExecution timeMemory
555833colossal_pepeTable Tennis (info1cup20_tabletennis)C++17
100 / 100
301 ms2976 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; int n, m; vector<int> v; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> m; v.resize(n + m); for (int i = 0; i < n + m; i++) { cin >> v[i]; } vector<int> ans(n); for (int i = (n / 2) - 1; i <= (n / 2) - 1 + m; i++) { int s = v[i] + v[i + 1], l = 0, r = n + m - 1, j = 0; while (l < r and j < n / 2) { while (r > l and v[l] + v[r] > s) r--; if (l < r and v[l] + v[r] == s) { ans[j] = v[l], ans[n - j - 1] = v[r]; j++; } l++; } if (j < n / 2) continue; for (int x : ans) { cout << x << ' '; } cout << '\n'; break; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...