Submission #481791

# Submission time Handle Problem Language Result Execution time Memory
481791 2021-10-21T23:35:39 Z Yazan_Alattar Table Tennis (info1cup20_tabletennis) C++14
11 / 100
3000 ms 3384 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};

int n, k, a[M];

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);
    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;
        }
    }
    return 0;
}
// Don't forget special cases. (n = 1?)
// Look for the constraints. (Runtime array? overflow?)
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 7 ms 368 KB Output is correct
3 Correct 8 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 560 ms 780 KB Output is correct
2 Correct 28 ms 3264 KB Output is correct
3 Execution timed out 3059 ms 3384 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3073 ms 3076 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -