제출 #482019

#제출 시각아이디문제언어결과실행 시간메모리
482019RedhoodTable Tennis (info1cup20_tabletennis)C++14
87 / 100
3080 ms37892 KiB
#include<bits/stdc++.h> #define pb push_back #define all(x) (x).begin(), (x).end() #define sz(x) (int)(x).size() #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; using namespace __gnu_cxx; using namespace std; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); int n , k; cin >> n >> k; vector < int > val(n + k); for(auto &i : val) cin >> i; gp_hash_table < int , int > mp; for(auto &i : val) mp[i] = 1; sort(all(val)); for(int i = 0; i <= k; ++i){ for(int j = sz(val) - 1; j >= sz(val) - k - 1; --j){ int alr = i + (sz(val) - 1 - j); if(alr > k) break; int S = val[i] + val[j]; int tot = 1; for(int p = i + 1; p < j; ++p){ if(S - val[p] <= val[p]) break; if(!mp[S - val[p]]){ alr++; if(alr > k) break; }else{ tot++; } } if(tot == n / 2){ for(int p : val){ if((S-p) != p && mp[S - p]) cout << p << ' '; } cout << endl; return 0; } } } assert(false); 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...