제출 #521291

#제출 시각아이디문제언어결과실행 시간메모리
521291BaytoroTable Tennis (info1cup20_tabletennis)C++17
87 / 100
3069 ms5696 KiB
#include <bits/stdc++.h> using namespace std; #define Baytoro_MayrambekovOrz void solve() #define ios ios::sync_with_stdio(false); cin.tie(NULL); #define pb push_back #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define fr first #define sc second #define int long long int n,k; vector<int> vec,ans; bool check(int x){ int i; int cnt=0; ans.clear(); int r=n+k-1; for(i=0;i<r && cnt<n/2;i++){ while(r>i && vec[i]+vec[r]>x) r--; if(r>i && vec[i]+vec[r]==x){ cnt++; ans.pb(vec[i]); ans.pb(vec[r]); } } return n/2==cnt; } int a,b,c,m,j,x,y,cnt=0,sum=0,res=0; Baytoro_MayrambekovOrz{ int i; cin>>n>>k; vec.resize(n+k); for(i=0;i<n+k;i++){ cin>>vec[i]; } for(i=0;i<=min(k*2,n+k);i++){ for(j=max(0ll,n-k);j<n+k;j++){ if(check(vec[i]+vec[j])){ sort(all(ans)); for(auto it: ans) cout<<it<<' '; return; } } } } main(){ ios; int T=1; //cin>>T; while(T--){ solve(); } }

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

tabletennis.cpp:50:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   50 | main(){
      | ^~~~
#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...