제출 #685913

#제출 시각아이디문제언어결과실행 시간메모리
685913ReLiceTable Tennis (info1cup20_tabletennis)C++14
29 / 100
3086 ms18100 KiB
#include<bits/stdc++.h> using namespace std; #define endl "\n" #define ll long long #define pb push_back #define pob pop_back #define sz size() #define fr first #define sc second #define all(x) x.begin(),x.end() void start(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } const ll N = 5e4+10; const ll mod=1e9+7; const ll inf=1e10; map<ll,ll> mp; vector <ll> ans; vector <ll> v; ll n,k; bool flag=false; void go(ll ind, ll u){ if(flag) return; if(u==0){ ll l=0,r=n-1,b=ans[0]+ans[n-1]; while(l<r){ if(ans[l]+ans[r]!=b) return; l++; r--; } flag=true; return; } if(ind==n+k) return; ans.pb(v[ind]); go(ind+1,u-1); if(flag) return; ans.pob(); go(ind+1,u); if(flag) return; } void solve(){ ll i,j; ll m,b,x=0,y=0,c=0,sum=0; cin>>n>>k; for(i=0;i<n+k;i++){ cin>>b; v.pb(b); mp[b]=i+1; sum+=b; }if(k==1){ b=sum-(n/2)*(v[0]+v[n]); x=v[0]+v[n]; if(mp[b]>=0){ ll l=0,r=n+k-1; bool flag=true; while(l<r){ if(l==mp[b]-1)l++; if(r==mp[b]-1)r--; if(v[l]+v[r]!=x) { flag=false; break; } l++; r--; } if(flag){ for(i=0;i<n+k;i++){ if(i==mp[b]-1)continue; cout<<v[i]<<' '; } cout<<endl; return; } } b=sum-(n/2)*(v[1]+v[n]); x=v[1]+v[n]; if(mp[b]==1){ ll l=1,r=n+k-1; bool flag=true; while(l<r){ if(v[l]+v[r]!=x) { flag=false; break; } l++; r--; } if(flag){ for(i=1;i<n+k;i++){ if(i==mp[b]-1)continue; cout<<v[i]<<' '; } cout<<endl; return; } } b=sum-(n/2)*(v[0]+v[n-1]); x=v[0]+v[n-1]; if(mp[b]==n+k){ ll l=0,r=n+k-2; bool flag=true; while(l<r){ if(v[l]+v[r]!=x) { flag=false; break; } l++; r--; } if(flag){ for(i=0;i<n+k;i++){ if(i==mp[b]-1)continue; cout<<v[i]<<' '; } cout<<endl; return; } } } else{ go(0,n); for(auto i : ans) cout<<i<<' '; cout<<endl; } } main(){ //fre(""); start(); ll t=1; //cin>>t; while(t--)solve(); }

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

tabletennis.cpp: In function 'void solve()':
tabletennis.cpp:45:10: warning: unused variable 'j' [-Wunused-variable]
   45 |     ll i,j;
      |          ^
tabletennis.cpp:46:8: warning: unused variable 'm' [-Wunused-variable]
   46 |     ll m,b,x=0,y=0,c=0,sum=0;
      |        ^
tabletennis.cpp:46:16: warning: unused variable 'y' [-Wunused-variable]
   46 |     ll m,b,x=0,y=0,c=0,sum=0;
      |                ^
tabletennis.cpp:46:20: warning: unused variable 'c' [-Wunused-variable]
   46 |     ll m,b,x=0,y=0,c=0,sum=0;
      |                    ^
tabletennis.cpp: At global scope:
tabletennis.cpp:136:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
  136 | 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...