Submission #365832

# Submission time Handle Problem Language Result Execution time Memory
365832 2021-02-12T12:36:33 Z fadi57 Table Tennis (info1cup20_tabletennis) C++14
0 / 100
124 ms 13292 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<ll,int>mp;
ll 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++){

   ll sum2=sum-a[i];
   mp[a[i]]=0;
   ll 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:32:5: warning: unused variable 'ans' [-Wunused-variable]
   32 | int ans=0;
      |     ^~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 492 KB Output is correct
2 Incorrect 2 ms 492 KB Extra information in the output file
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 17 ms 1900 KB Output is correct
2 Correct 122 ms 13292 KB Output is correct
3 Incorrect 124 ms 13036 KB Extra information in the output file
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 121 ms 12396 KB Output does not have symmetry property
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 364 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Extra information in the output file
2 Halted 0 ms 0 KB -