제출 #423766

#제출 시각아이디문제언어결과실행 시간메모리
423766oolimryTable Tennis (info1cup20_tabletennis)C++17
87 / 100
3085 ms3936 KiB
#include <bits/stdc++.h> using namespace std; #define sz(x) (int) (x).size() #define all(x) (x).begin(), (x).end() #define show(x) cerr << #x << " is " << x << endl; #define show2(x,y) cerr << #x << " is " << x << " " << #y << " is " << y << endl; #define show3(x,y,z) cerr << #x << " is " << x << " " << #y << " is " << y << " " << #z << " is " << z << endl; #define tern(cond, a, b) (cond ? a : b) typedef long long lint; typedef pair<lint,lint> ii; int n, K; vector<int> arr; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> K; n += K; arr.resize(n); for(int i = 0;i < n;i++) cin >> arr[i]; for(int s = 0;s <= K+1;s++){ for(int e = n-1;e >= n-K-1;e--){ if(s + (n-1)-e > K) continue; int str = arr[s]+arr[e]; vector<int> ans; for(int i = s;i <= e;i++){ auto it = lower_bound(all(arr), str-arr[i]); if(it == arr.end()) continue; if(*it == str-arr[i] and arr[i] != str-arr[i]) ans.push_back(arr[i]); } if(sz(ans) == n-K){ for(int x : ans) cout << x << " "; 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...