Submission #667585

#TimeUsernameProblemLanguageResultExecution timeMemory
667585Hacv16Table Tennis (info1cup20_tabletennis)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
const int MAX = 2e6 + 50;
const int INF = 0x3f3f3f3f;

int n, k, tot, ans = -1;
vector<ll> v;

bool solve(ll l, ll r, ll sum, bool flag){
    ll id = 0;
    bool alreadyBad = flag;

    for(int i = l + 1, j = r - 1; i < j; i++, j--){
        if(v[i] + v[j] != sum){
            if(alreadyBad) return false;
            alreadyBad = true;

            int di = v[i + 1] - v[i];
            int dj = v[j] - v[j - 1];

            if(di > dj) id = i++;
            else id = j--;
        }
    }

    ans = id;
    return true;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n >> k;

    tot = n + k;

    for(int i = 0; i < tot; i++){
        ll x; cin >> x;
        v.push_back(x);
    }

    vector<ll> trash;

    solve(0, tot - 1, v[0] + v[tot - 1], false);
    if(solve(0, tot - 2, v[0] + v[tot - 2]), true) ans = tot - 1;
    if(solve(1, tot - 1, v[0] + v[tot - 1]), true) ans = 0;

    for(int i = 0; i < tot; i++){
        if(i == ans) continue;
        cout << v[i] << ' ';
    }

    cout << '\n';

    return 0;
}

Compilation message (stderr)

tabletennis.cpp: In function 'int main()':
tabletennis.cpp:48:43: error: too few arguments to function 'bool solve(ll, ll, ll, bool)'
   48 |     if(solve(0, tot - 2, v[0] + v[tot - 2]), true) ans = tot - 1;
      |                                           ^
tabletennis.cpp:11:6: note: declared here
   11 | bool solve(ll l, ll r, ll sum, bool flag){
      |      ^~~~~
tabletennis.cpp:49:43: error: too few arguments to function 'bool solve(ll, ll, ll, bool)'
   49 |     if(solve(1, tot - 1, v[0] + v[tot - 1]), true) ans = 0;
      |                                           ^
tabletennis.cpp:11:6: note: declared here
   11 | bool solve(ll l, ll r, ll sum, bool flag){
      |      ^~~~~