Submission #717389

# Submission time Handle Problem Language Result Execution time Memory
717389 2023-04-01T22:14:23 Z vjudge1 Table Tennis (info1cup20_tabletennis) C++17
0 / 100
93 ms 13024 KB
#include <bits/stdc++.h>
using namespace std;
// #define int long long
#define endl '\n'
#define F first
#define S second
#define pb push_back
#define all(a) a.begin(),a.end()
const int N=1e5;
const int off=(1<<20);
const int MOD = 1e9+7;


signed main(){
   ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
   int n,k;
   cin >> n >> k;
   int sz=n+k;
   int a[sz];
   unordered_map<int,bool>mp;
   for(int i=0;i<sz;i++){
      cin >>a[i];
      mp[a[i]]=1;
   }
   sort(a,a+sz);

   vector<int>v;
   for(int i=0;i<=k;i++){
      for(int j=0;j<=k-i;j++){
         v.pb(a[i]+a[sz-j-1]);
         // cout<<v.back()<<' ';
      }
   }
   // cout<<v.size()<<endl;
   int h[v.size()]={0};

   for(int j=0;j<v.size();j++){
      for(int i=0;i<sz;i++){
         if(a[i]!=v[j]-a[i]){
            if(!mp[v[j]-a[i]]){
               if(h[j]<k&&h[j]>=0)h[j]++;
               else h[j]=-1;
            }
         }
         else{
            if(h[j]<k&&h[j]>=0)h[j]++;
            else h[j]=-1;
         }
         if(h[j]==-1)break;
      }
      if(h[j]!=-1){
         int ans=h[j];
         for(int i=0;i<sz;i++){
            if(mp[ans-a[i]]&&ans-a[i]!=a[i])cout<<a[i]<<' ';
         }
         return 0;
      }
   }


}
/*

*/

Compilation message

tabletennis.cpp: In function 'int main()':
tabletennis.cpp:37:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |    for(int j=0;j<v.size();j++){
      |                ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 468 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 1968 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 93 ms 13024 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 852 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 7360 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -