Submission #717385

# Submission time Handle Problem Language Result Execution time Memory
717385 2023-04-01T22:07:50 Z vjudge1 Table Tennis (info1cup20_tabletennis) C++17
87 / 100
3000 ms 249812 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

const int mxN = 2e5 + 7;

int arr[mxN];

int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int n, k;
    cin >> n >> k;
    
    bitset<2000000001> in;
    for (int i = 0; i < n + k; ++i) {
        cin >> arr[i];
        in[arr[i]] = true;
    }
    
    assert(n >= 2);
    for (int i = 0; i < k + 2;  ++i) {
        for (int j = n + k - 1; j >= n - 1 && j > i; --j) {
            int sum = arr[i] + arr[j];

            vector<int> nums;
            for (int l = 0; l < n + k; ++l) {
                if (sum - arr[l] >= 0 && in[sum - arr[l]]) {
                    nums.push_back(arr[l]);
                }
            }

            if (nums.size() >= n) {
                for (int l = 0; l < n; ++l) {
                    cout << nums[l] << ' ';
                }
                cout << "\n";
                exit(0);
            }
        }
    }
}
// 1 2 1 2 3

Compilation message

tabletennis.cpp: In function 'int32_t main()':
tabletennis.cpp:34:29: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   34 |             if (nums.size() >= n) {
      |                 ~~~~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Correct 121 ms 245020 KB Output is correct
2 Correct 118 ms 244944 KB Output is correct
3 Correct 117 ms 244952 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 120 ms 245584 KB Output is correct
2 Correct 157 ms 248820 KB Output is correct
3 Correct 158 ms 248896 KB Output is correct
4 Correct 154 ms 248896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 151 ms 248824 KB Output is correct
2 Correct 155 ms 248908 KB Output is correct
3 Correct 157 ms 248900 KB Output is correct
4 Correct 154 ms 248888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 114 ms 244940 KB Output is correct
2 Correct 121 ms 244872 KB Output is correct
3 Correct 115 ms 244804 KB Output is correct
4 Correct 116 ms 244828 KB Output is correct
5 Correct 114 ms 244916 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 112 ms 244984 KB Output is correct
2 Correct 113 ms 244812 KB Output is correct
3 Correct 117 ms 244884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 113 ms 244924 KB Output is correct
2 Correct 118 ms 244940 KB Output is correct
3 Correct 113 ms 244964 KB Output is correct
4 Correct 114 ms 244860 KB Output is correct
5 Correct 115 ms 244952 KB Output is correct
6 Correct 115 ms 244900 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 123 ms 244924 KB Output is correct
2 Correct 526 ms 249028 KB Output is correct
3 Correct 173 ms 248968 KB Output is correct
4 Correct 367 ms 248836 KB Output is correct
5 Correct 166 ms 248896 KB Output is correct
6 Correct 169 ms 248812 KB Output is correct
7 Correct 369 ms 249812 KB Output is correct
8 Correct 166 ms 249796 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 114 ms 244844 KB Output is correct
2 Execution timed out 3088 ms 246216 KB Time limit exceeded
3 Halted 0 ms 0 KB -