Submission #685911

#TimeUsernameProblemLanguageResultExecution timeMemory
685911ReLiceTable Tennis (info1cup20_tabletennis)C++14
9 / 100
3095 ms19528 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;
    }
    go(0,n);
    for(auto i : ans) cout<<i<<' ';
    cout<<endl;
}
main(){
    //fre("");
    start();
    ll t=1;
    //cin>>t;
    while(t--)solve();
}

Compilation message (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:12: warning: unused variable 'x' [-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:58:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   58 | 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...