Submission #691779

# Submission time Handle Problem Language Result Execution time Memory
691779 2023-01-31T14:22:02 Z VahanAbraham Table Tennis (info1cup20_tabletennis) C++14
0 / 100
22 ms 6132 KB
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <sstream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <math.h>
#include <cmath>
#include <vector>
using namespace std;


#define ll long long
#define fr first
#define sc second
#define pb push_back
#define US freopen("hps.in", "r", stdin); freopen("hps.out", "w", stdout);

ll gcd(ll a, ll b)
{
    if (a == 0 || b == 0) {
        return  max(a, b);
    }
    if (a <= b) {
        return gcd(a, b % a);
    }
    else {
        return gcd(a % b, b);
    }
}

ll lcm(ll a, ll b) {
    return (a / gcd(a, b)) * b;
}

int isprime(int p)
{
    if (p <= 1) {
        return 0;
    }
    for (int i = 2; i * i <= p; i++) {
        if (p % i == 0) {
            return 0;
        }
    }
    return 1;
}

const int N = 200005;
pair<ll, ll>  p[N], ps[N];
vector <int> g[N];


ll a[N];




void solve() {
    int n, k;
    cin >> n >> k;
    int h = n + k;
    for (int i = 0;i < h;i++) {
        cin >> a[i];
    }
    sort(a, a + h);
    
    if (n == 2) {
        if (a[1] == a[2]) {
            cout << a[1] << " " << a[2] << endl;
        }
        else {
            if (a[1] == a[0]) {
                cout << a[1] << " " << a[0];
            }
            else {
                cout << a[0] << " " << a[2] << endl;
            }
        }
    }
    return;
    bool fl = true;
    int z = 0;
    ll x = a[1] - a[0],ans=0;
    for (int i = 2;i < h;i++) {
        if (a[i] - a[i - 1] != x) {
            if (z == 1) {
                fl = false;
                break;
            }
            z++;
            ans = i;
            if (a[i + 1] - a[i - 1] != x && i != h-1) {
                fl = false;
                break;
            }
            i += 2;
        }
    }
    if (fl == true) {
        for (int i = 0;i < h;i++) {
            if (i != ans) {
                cout << a[i] << " ";
            }
        }
    }
    else {
        fl = true;
        x = a[2] - a[1];
        for (int i = 3;i < h;i++) {
            if (a[i] - a[i - 1] != x) {
                fl = false;
                break;
            }
        }
        if (fl == true) {
            for (int i = 1;i < h;i++) {
                cout << a[i] << " ";
            }
        }
        else {
            cout << a[0] << " ";
            for (int i = 2;i < h;i++) {
                cout << a[i] << " ";
            }
        }
    }
    return;
}


int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    //US
    int tt = 1;
    //cin >> tt;
    while (tt--) {
        solve();
    }
}
/*

              %%           %%         %           %%      %%            %          %%     %%
               %%         %%        %% %%         %%      %%          %% %%        %%%%   %%
                %%       %%        %%   %%        %%      %%         %%   %%       %% %%  %%
                 %%     %%        %%%%%%%%%       %%%%%%%%%%        %%%%%%%%%      %%  %% %%
                  %%   %%        %%       %%      %%      %%       %%       %%     %%   %%%%
                   %% %%        %%         %%     %%      %%      %%         %%    %%    %%%
                     %         %%           %%    %%      %%     %%           %%   %%     %%


*/
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 4996 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 5076 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 6132 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 4948 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 4948 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 4948 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4948 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4948 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -