제출 #675134

#제출 시각아이디문제언어결과실행 시간메모리
675134uyluluTable Tennis (info1cup20_tabletennis)C++17
87 / 100
3058 ms5828 KiB
#include <bits/stdc++.h> using namespace std; #define ld long double #define int long long #define endl "\n" const int N = 3e5,K = 400; int num[N + 1],n,k; vector<pair<int,int>> res; inline void build(int sum,int l,int r) { res.clear(); int curr = r - 1; for(int i = l + 1;i < curr;i++) { while(curr > i && num[i] + num[curr] > sum) curr--; if(num[i] + num[curr] == sum) { res.push_back({num[i],num[curr]}); curr--; } } if((int)res.size() < n/2 - 1) { return; } vector<int> kq; for(int i = 0;i < n/2 - 1;i++) { kq.push_back(res[i].first); kq.push_back(res[i].second); } kq.push_back(num[l]); kq.push_back(num[r]); sort(kq.begin(),kq.end()); for(auto u : kq) { cout<<u<<" "; } exit(0); } signed main() { ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); // freopen("in.txt","r",stdin); // freopen("out.txt","w",stdout); cin>>n>>k; int len = n + k; for(int i = 1;i <= len;i++) { cin>>num[i]; } for(int i = 1;i <= k + 1 && i <= len;i++) { int left = len - (k - i + 1); for(int j = left;j <= len;j++) { build(num[i] + num[j],i,j); } } 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...