# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
957094 | 2024-04-03T00:16:18 Z | MuntherCarrot | Table Tennis (info1cup20_tabletennis) | C++14 | 203 ms | 33996 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #define endl '\n' #define all(x) x.begin(),x.end() const int MOD = 1e9 + 7, SZ = 1e5 + 10, MX = 1e9; signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, k; cin >> n >> k; int arr[n + k]; for(int &i : arr) cin >> i; map<int, int> frq; vector<int> vec; if(k*4 >= n + k){ for(int i=0;i<n+k;i++){ for(int j=i+1;j<n+k;j++) vec.push_back(arr[i] + arr[j]); } } else{ for(int i=0;i<=k*2;i++){ for(int j=0;j<=k*2;j++){ if(i >= n + k - j - 1) break; ll x = arr[i] + arr[n + k - j - 1]; if(++frq[x] == k) vec.push_back(x); } } } for(ll i : vec){ vector<int> ans; int l = 0, r = n + k - 1; while(l < r){ ll x = arr[l] + arr[r]; if(ans.size() == n) break; if(x == i){ ans.push_back(arr[l]); ans.push_back(arr[r]); } if(x >= i) r--; if(x <= i) l++; } if(ans.size() == n){ sort(all(ans)); for(int x : ans) cout << x << ' '; break; } } return 0; } // https://www.youtube.com/watch?v=zL32whN6p0A&ab_channel=HeidiAdel-CartoonWorld
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 476 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 1116 KB | Output is correct |
2 | Correct | 26 ms | 4720 KB | Output is correct |
3 | Correct | 25 ms | 4572 KB | Output is correct |
4 | Correct | 27 ms | 4556 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 25 ms | 4556 KB | Output is correct |
2 | Correct | 28 ms | 4556 KB | Output is correct |
3 | Correct | 25 ms | 4564 KB | Output is correct |
4 | Correct | 25 ms | 4568 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 6 ms | 604 KB | Output is correct |
3 | Correct | 0 ms | 604 KB | Output is correct |
4 | Correct | 4 ms | 604 KB | Output is correct |
5 | Correct | 1 ms | 604 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 536 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 25 ms | 4592 KB | Output is correct |
3 | Correct | 30 ms | 4552 KB | Output is correct |
4 | Correct | 25 ms | 4560 KB | Output is correct |
5 | Correct | 25 ms | 4512 KB | Output is correct |
6 | Correct | 25 ms | 4552 KB | Output is correct |
7 | Correct | 25 ms | 4544 KB | Output is correct |
8 | Correct | 26 ms | 4528 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 992 KB | Output is correct |
2 | Correct | 203 ms | 32328 KB | Output is correct |
3 | Correct | 192 ms | 33996 KB | Output is correct |
4 | Correct | 159 ms | 29916 KB | Output is correct |
5 | Correct | 62 ms | 11460 KB | Output is correct |
6 | Correct | 43 ms | 4812 KB | Output is correct |
7 | Correct | 138 ms | 26488 KB | Output is correct |
8 | Correct | 142 ms | 28880 KB | Output is correct |