Submission #717920

# Submission time Handle Problem Language Result Execution time Memory
717920 2023-04-02T20:56:35 Z vjudge1 Table Tennis (info1cup20_tabletennis) C++17
9 / 100
79 ms 12648 KB
#include "bits/stdc++.h"
#define ll long long
using namespace std;
const ll mod = 1000000007;

int b[150001];

signed main () {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    // freopen("cowland.in","r",stdin);
    // freopen("cowland.out","w",stdout);

    int n, k;
    cin >> n >> k;
    vector<int> v;
    for(int i = 0; i < n + k; i++) {
        int x;
        cin >> x;
        v.push_back(x);
    }
    sort(v.begin(), v.end());
    set<int> s;
    for(int i = 0; i <= k; i++) {
        int j = n + k - 1;
        while(i < j && i + ((n + k) - j - 1) <= k)
            s.insert(v[i] + v[j--]);
    }
    for(int x : s) {
        int y = 0, r = 0;
        for(int l = 0; l < n + k; l++) {
            if(b[l])
                continue;
            while(r < n + k && l >= r)
                r++;
            if(v[l] + v[r] < x) {
                while(r < n + k && v[l] + v[r] < x)
                    r++;
            }
            else if(v[l] + v[r] > x) {
                while(l < r && v[l] + v[r] > x)
                    r--;
            }
            if(l < r && r < n + k) {
                b[l] = b[r] = 1;
                y += 2;
                if(y == n)
                    break;
            }
        }
        if(y == n) {
            set<int> ans;
            for(int i = 0; i < n + k; i++) {
                if(b[i])
                    ans.insert(v[i]);
            }
            for(int i : ans)
                cout << i << " ";
            return 0;
        }
        for(int i = 0; i < n + k; i++)
            b[i] = 0;
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 1620 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 62 ms 9924 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Incorrect 1 ms 468 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 468 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 63 ms 8944 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 15 ms 4052 KB Output is correct
2 Incorrect 79 ms 12648 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -