답안 #717434

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
717434 2023-04-01T22:56:01 Z vjudge1 Table Tennis (info1cup20_tabletennis) C++17
29 / 100
3000 ms 6336 KB
#include <bits/stdc++.h>
#include <fstream>
#define endl '\n'
#define mod 998244353
#define INF 1000000000000000000
#define ll long long
///#define cin fin
///#define cout fout
#define fi first
#define se second
using namespace std;
///ofstream fout("herding.out");
///ifstream fin("herding.in");


int main()
{
    ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
    int n, k; cin >> n >> k; vector<long long> v; int arr[n+k] = {}; map<long long,int> mp; int pos = -1;
    for(int i = 0; i < n+k; i++) {
        int x; cin >> x; v.push_back(x);
    }

    if(k > 1) {
           for(int i = 0; i < (1<<(n+k)); i++) {
        vector<long long> vv; int cnt = 0; map<long long,int> mp2;
        for(int j = 0; j < n+k; j++) {
            if((i&(1<<j)) > 0) vv.push_back(v[j]);
            else cnt++;
        }
        if(cnt != k) continue;
        int siz = vv.size(); bool ok = false;
        for(int j = 0; j < (siz/2); j++) {
            mp2[vv[j]+vv[siz-j-1]]++;
            if(mp2[vv[j]+vv[siz-j-1]] == n/2) ok = true;
        }
        if(ok) {
            for(int j = 0; j < siz; j++) {
                cout << vv[j] << ' ';
            }
            return 0;
        }
    }
    }
    for(int i = 1; i <= (n+k)/2; i++) {
        int j = (n+k)-i; arr[i] = j; arr[j] = i;
        mp[v[i]+v[j]]++;
        if(mp[v[i]+v[j]] == n/2) pos = 0;
    }

    for(int i = 1; i < (n+k); i++) {
        mp[v[arr[i]]+v[i]]--;
        arr[arr[i]] = i-1; arr[i-1] = arr[i];
        mp[v[i-1]+v[arr[i-1]]]++;
        if(mp[v[i-1]+v[arr[i-1]]] == n/2) pos = i;
    }

    for(int i = 0; i < (n+k); i++) {
        if(i == pos) continue;
        cout << v[i] << ' ';
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 856 KB Output is correct
2 Correct 63 ms 4372 KB Output is correct
3 Correct 79 ms 4340 KB Output is correct
4 Correct 90 ms 4328 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3043 ms 3124 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 212 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 340 KB Output does not have symmetry property
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 120 ms 6336 KB Output does not have symmetry property
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 24 ms 324 KB Extra information in the output file
2 Halted 0 ms 0 KB -