제출 #366029

#제출 시각아이디문제언어결과실행 시간메모리
366029sobaTable Tennis (info1cup20_tabletennis)C++14
72 / 100
3109 ms340840 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n , k; cin >> n >> k ; ll teams=n/2; vector<ll>v; ll x , y ; n+=k; map<ll,int>mp; for(int i = 0 ; i < n ; i++) { cin >> x; mp[x]++; v.push_back(x); } sort(v.begin(), v.end()); vector<ll>poten; for(int i = 0 ; i< k+1 ; i++) { for( int j = n-1; j >= n-(k+1) ; j-- ) { poten.push_back(v[i]+v[j]); } } int sz=poten.size(); vector<ll>ansa; for( int i = 0 ; i < sz ; i++) { ansa.clear(); ll tmp=teams; for(int j = 0 ; v[j]<(poten[i]/2) ; j++ ) { if(poten[i]-v[j]==v[j])continue; if(mp[poten[i]-v[j]]) { tmp--; ansa.push_back(poten[i]-v[j]); ansa.push_back(v[j]); } if(tmp==0) break; } if(tmp==0) { break; } } // cout << ansa[0] << "\n"; // cout << ansa.size() << "\n"; sort( ansa.begin() , ansa.end()); for(int i = 0 ; i < teams*2 ; i++) { cout << ansa[i] << " " ; } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

tabletennis.cpp: In function 'int main()':
tabletennis.cpp:11:12: warning: unused variable 'y' [-Wunused-variable]
   11 |     ll x , y ;
      |            ^
#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...