Submission #756214

# Submission time Handle Problem Language Result Execution time Memory
756214 2023-06-11T10:11:36 Z Alkarat Table Tennis (info1cup20_tabletennis) C++14
0 / 100
19 ms 2260 KB
#include <bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int n,k,a[N];
vector<int>g;
map<int,int>ck;
bool check(int l,int r)
{
    int sum=a[l]+a[r];
    g.clear();
    while(l<r)
    {
        if(a[l]+a[r]==sum) 
        {
            g.push_back(a[l]);
            g.push_back(a[r]);
            l++;
            r--;
        }
        else if(a[l]+a[r]>sum) r--;
        else l++;
    }
    if(g.size()==n)
    {
        sort(g.begin(),g.end());
        for(int e:g) cout<<e<<" ";
        exit(0);
    }
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>k;
    for(int i=1; i<=n+k; i++) cin>>a[i];
    for(int i=1; i<=k+1; i++) for(int j=n+k; j>=i+n-1; j--) check(i,j);
}

Compilation message

tabletennis.cpp: In function 'bool check(int, int)':
tabletennis.cpp:23:16: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   23 |     if(g.size()==n)
      |        ~~~~~~~~^~~
tabletennis.cpp:29:1: warning: control reaches end of non-void function [-Wreturn-type]
   29 | }
      | ^
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 852 KB Output is correct
2 Incorrect 19 ms 2260 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 868 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 328 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -