Submission #365815

# Submission time Handle Problem Language Result Execution time Memory
365815 2021-02-12T12:24:16 Z fadi57 Table Tennis (info1cup20_tabletennis) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const ll mx=100005;
const int mod= 1e9+7 ;
const ll inf=1e12+4;

//***while there is life there is hope


int n,k;

int main() {



	 //ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

cin>>n>>k;
int nteams=n/2;
map<int,int>mp;l
l sum=0;
ll a[n+k+5];
for(int i=0;i<n+k;i++){

    cin>>a[i];
    sum+=a[i];
    mp[a[i]]++;

}
int ans=0;
/*

4
1
1 2 5 6 100
1 2 5 6 100
*/
int can=-1;
for(int i=0;i<n+k;i++){

   int sum2=sum-a[i];
   mp[a[i]]=0;
   int target=sum2/nteams;int ok=1;
   if(sum2%nteams!=0){continue;}else{
    int f=0;int en=n+k-1;

    for(int j=0;j<nteams;j++){
        if(f==i){f++;}  if(en==i){en--;}
     //   cout<<f<<" "<<en<<" "<<a[f]+a[en]<<endl;
        if(a[f]+a[en]!=target){ok=0;break;}
        f++;en--;
    }
    if(ok){can=i;}break;;

   }

}
for(int i=0;i<n+k;i++){

 if(i!=can){cout<<a[i]<<" ";}
}









}

Compilation message

tabletennis.cpp: In function 'int main()':
tabletennis.cpp:22:16: error: 'l' was not declared in this scope
   22 | map<int,int>mp;l
      |                ^
tabletennis.cpp:28:5: error: 'sum' was not declared in this scope
   28 |     sum+=a[i];
      |     ^~~
tabletennis.cpp:43:13: error: 'sum' was not declared in this scope; did you mean 'sum2'?
   43 |    int sum2=sum-a[i];
      |             ^~~
      |             sum2
tabletennis.cpp:32:5: warning: unused variable 'ans' [-Wunused-variable]
   32 | int ans=0;
      |     ^~~