Submission #365964

# Submission time Handle Problem Language Result Execution time Memory
365964 2021-02-12T15:29:54 Z ahmedfouadnew Table Tennis (info1cup20_tabletennis) C++17
0 / 100
3000 ms 251552 KB
#include<bits/stdc++.h>
using namespace std;
#define s second
#define f first
#define pb push_back
#define int long long
int n,a[200001],k;
unordered_map<int,int>mp;
void fun(int bal)
{
    vector<int>v;
    for(int i=0;i<n+k;i++)
    {
        if(mp[bal-a[i]])
        {
            v.pb(a[i]);
        }
    }
    if(v.size()!=n) return;
    sort(v.begin(),v.end());
    for(int i=0;i<v.size();i++)
    {
        cout<<v[i]<<" \n"[i+1==v.size()];
    }
    exit(0);
}
signed main()
{
    cin>>n>>k;
    for(int i=0;i<n+k;i++)
    {
        cin>>a[i];
        mp[a[i]]=1;
    }
    for(int i=0;i<k+1;i++)
    {
        for(int j=n+k-1;j>=n;j--)
        {
            fun(a[i]+a[j]);
        }
    }

   return 0;
}

Compilation message

tabletennis.cpp: In function 'void fun(long long int)':
tabletennis.cpp:19:16: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   19 |     if(v.size()!=n) return;
      |        ~~~~~~~~^~~
tabletennis.cpp:21:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     for(int i=0;i<v.size();i++)
      |                 ~^~~~~~~~~
tabletennis.cpp:23:30: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |         cout<<v[i]<<" \n"[i+1==v.size()];
      |                           ~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 620 KB Output is correct
2 Incorrect 3 ms 492 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 15 ms 1772 KB Output is correct
2 Correct 216 ms 19676 KB Output is correct
3 Incorrect 223 ms 19724 KB Unexpected end of file - int32 expected
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 376 ms 33392 KB Output is correct
2 Incorrect 538 ms 42736 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 472 ms 39792 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 748 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 748 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3081 ms 251552 KB Time limit exceeded
2 Halted 0 ms 0 KB -