Submission #365980

# Submission time Handle Problem Language Result Execution time Memory
365980 2021-02-12T15:50:37 Z ahmedfouadnew Table Tennis (info1cup20_tabletennis) C++17
57 / 100
3000 ms 251844 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;
    for(int i=0;i<v.size();i++)
    {
        if(i) printf(" ");
        printf("%d",v[i]);

    }
    exit(0);
}
signed main()
{
    scanf("%d%d",&n,&k);
    for(int i=0;i<n+k;i++)
    {
        scanf("%d",a+i);
        mp[a[i]]=1;
    }
    for(int i=0;i<=k+1;i++)
    {
        int cnt=50;
        while(cnt--)
        {
        int drgn=rand()%(k+1);
            fun(a[i]+a[n+k-1-drgn]);
        }
    }

   return 0;
}

Compilation message

tabletennis.cpp: In function 'void fun(int)':
tabletennis.cpp:19:16: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   19 |     if(v.size()!=n) return;
      |        ~~~~~~~~^~~
tabletennis.cpp:20:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for(int i=0;i<v.size();i++)
      |                 ~^~~~~~~~~
tabletennis.cpp: In function 'int main()':
tabletennis.cpp:30:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   30 |     scanf("%d%d",&n,&k);
      |     ~~~~~^~~~~~~~~~~~~~
tabletennis.cpp:33:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   33 |         scanf("%d",a+i);
      |         ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 748 KB Output is correct
2 Correct 1 ms 492 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 1692 KB Output is correct
2 Correct 833 ms 31216 KB Output is correct
3 Correct 100 ms 10676 KB Output is correct
4 Correct 91 ms 10676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 783 ms 32884 KB Output is correct
2 Correct 248 ms 22236 KB Output is correct
3 Correct 1405 ms 42408 KB Output is correct
4 Correct 244 ms 22236 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 176 ms 18908 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 37 ms 8756 KB Output is correct
3 Correct 4 ms 1132 KB Output is correct
4 Correct 74 ms 10292 KB Output is correct
5 Correct 3 ms 1132 KB Output is correct
6 Correct 8 ms 1260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Execution timed out 3076 ms 240704 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3068 ms 251844 KB Time limit exceeded
2 Halted 0 ms 0 KB -