Submission #717917

# Submission time Handle Problem Language Result Execution time Memory
717917 2023-04-02T20:45:17 Z vjudge1 Table Tennis (info1cup20_tabletennis) C++17
9 / 100
3000 ms 5216 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, l = 0, r = n + k - 1;
        while(l < r) {
            if(v[l] + v[r] == x) {
                b[l] = b[r] = 1;
                y += 2;
                l++, r--;
            }
            else if(v[l] + v[r] < k)
                l++;
            else
                r--;
        }
        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 0 ms 340 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 596 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 1608 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 3 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 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Incorrect 2 ms 340 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 Runtime error 55 ms 1876 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 18 ms 4052 KB Output is correct
2 Execution timed out 3053 ms 5216 KB Time limit exceeded
3 Halted 0 ms 0 KB -