Submission #481805

# Submission time Handle Problem Language Result Execution time Memory
481805 2021-10-22T00:28:33 Z Yazan_Alattar Table Tennis (info1cup20_tabletennis) C++14
0 / 100
41 ms 2624 KB
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <utility>
#include <cmath>
#include <numeric>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define all(x) x.begin(), x.end()
const int M = 200007;
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const double pi = acos(-1);
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

map <int,int> cnt;
int n, k, a[M], sum = -1;

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin >> n >> k;
    for(int i = 1; i <= n + k; ++i) cin >> a[i];
    sort(a + 1, a + n + 1);
    if(n <= 2000)
    {
        for(int i = 1; i <= n + k; ++i){
            vector <int> v;
            for(int j = 1; j <= n + k; ++j) if(j != i) v.pb(a[j]);
            int sum = v[0] + v.back(), wr = 0;
            for(int j = 0; j < n / 2; ++j) if(v[j] + v[n - j - 1] != sum) wr = 1;
            if(!wr){
                for(int j = 1; j <= n + k; ++j) if(j != i) cout << a[j] << " ";
                cout << endl;
                break;
            }
        }
    }
    for(int i = 2; i <= n + k; ++i) ++cnt[a[i] - a[i - 1]];
    for(auto i : cnt) if(i.S > cnt[sum]) sum = i.F;
    for(int i = 2; i < n + k; ++i){
        if(a[i] - a[i - 1] != sum && a[i + 1] - a[i] != sum){
            for(int j = 1; j <= n + k; ++j) if(j != i) cout << a[j] << " ";
            cout << endl;
            return 0;

        }
    }
    if(a[2] - a[1] != sum) for(int i = 2; i <= n + k; ++i) cout << a[i] << " ";
    else for(int i = 1; i < n + k; ++i) cout << a[i] << " ";
    cout << endl;
    return 0;
}
// Don't forget special cases. (n = 1?)
// Look for the constraints. (Runtime array? overflow?)
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 544 KB Output is correct
2 Incorrect 41 ms 2624 KB Output does not have symmetry property
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 2372 KB Output does not have symmetry property
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output does not have symmetry property
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output does not have symmetry property
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Extra information in the output file
2 Halted 0 ms 0 KB -