# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
339160 | 2020-12-24T17:23:15 Z | cheissmart | Table Tennis (info1cup20_tabletennis) | C++14 | 538 ms | 33264 KB |
#include <bits/stdc++.h> #define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0); #define F first #define S second #define V vector #define PB push_back #define MP make_pair #define EB emplace_back #define ALL(v) (v).begin(), (v).end() #define debug(x) cerr << "Line(" << __LINE__ << ") -> " << #x << " is " << x << endl using namespace std; typedef long long ll; typedef pair<int, int> pi; typedef V<int> vi; const int INF = 1e9 + 7; signed main() { IO_OP; int n, k; cin >> n >> k; vi a(n + k); for(int i = 0; i < n + k; i++) cin >> a[i]; auto check = [&] (int sum) { vi ans; int l = 0, r = n + k - 1; while(l < r && ans.size() < n) { if(a[l] + a[r] == sum) { ans.PB(a[l]); ans.PB(a[r]); l++, r--; } else if(a[l] + a[r] < sum) l++; else r--; } sort(ALL(ans)); if(ans.size() == n) { for(int i:ans) cout << i << " "; cout << endl; exit(0); } }; if(n + k < 4 * k) { for(int left = 0; left <= k; left++) { for(int right = 0; right + left <= k; right++) { int l = left, r = n + k - right - 1; check(a[l] + a[r]); } } } else { unordered_map<int, int> cnt; for(int i = 0; i < 2 * k; i++) for(int j = 0; j < 2 * k; j++) cnt[a[i] + a[n + k - j - 1]]++; for(pi p:cnt) if(p.S >= k) check(p.F); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 1052 KB | Output is correct |
2 | Correct | 40 ms | 3392 KB | Output is correct |
3 | Correct | 41 ms | 3196 KB | Output is correct |
4 | Correct | 41 ms | 3176 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 42 ms | 3132 KB | Output is correct |
2 | Correct | 40 ms | 3176 KB | Output is correct |
3 | Correct | 40 ms | 3176 KB | Output is correct |
4 | Correct | 40 ms | 3196 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 3 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 2 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
2 | Correct | 2 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 492 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 2 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 40 ms | 3168 KB | Output is correct |
3 | Correct | 43 ms | 3168 KB | Output is correct |
4 | Correct | 62 ms | 3192 KB | Output is correct |
5 | Correct | 46 ms | 3176 KB | Output is correct |
6 | Correct | 52 ms | 4040 KB | Output is correct |
7 | Correct | 45 ms | 3188 KB | Output is correct |
8 | Correct | 49 ms | 3168 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 376 KB | Output is correct |
2 | Correct | 292 ms | 30704 KB | Output is correct |
3 | Correct | 289 ms | 33264 KB | Output is correct |
4 | Correct | 269 ms | 31068 KB | Output is correct |
5 | Correct | 538 ms | 12084 KB | Output is correct |
6 | Correct | 65 ms | 5832 KB | Output is correct |
7 | Correct | 172 ms | 24156 KB | Output is correct |
8 | Correct | 203 ms | 25692 KB | Output is correct |