Submission #717419

# Submission time Handle Problem Language Result Execution time Memory
717419 2023-04-01T22:31:33 Z vjudge1 Table Tennis (info1cup20_tabletennis) C++17
87 / 100
3000 ms 493748 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, bad;
    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];

            if (bad[sum]) {
                continue;
            }

            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);
            }
            bad[sum] = true;
        }
    }
}
// 1 2 1 2 3

Compilation message

tabletennis.cpp: In function 'int32_t main()':
tabletennis.cpp:38: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]
   38 |             if (nums.size() >= n) {
      |                 ~~~~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Correct 361 ms 489548 KB Output is correct
2 Correct 225 ms 489572 KB Output is correct
3 Correct 236 ms 489676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 230 ms 490192 KB Output is correct
2 Correct 287 ms 493528 KB Output is correct
3 Correct 284 ms 493504 KB Output is correct
4 Correct 270 ms 493496 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 271 ms 493480 KB Output is correct
2 Correct 270 ms 493480 KB Output is correct
3 Correct 270 ms 493640 KB Output is correct
4 Correct 285 ms 493516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 235 ms 489452 KB Output is correct
2 Correct 242 ms 489536 KB Output is correct
3 Correct 243 ms 489520 KB Output is correct
4 Correct 235 ms 489580 KB Output is correct
5 Correct 239 ms 489532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 266 ms 489532 KB Output is correct
2 Correct 228 ms 489504 KB Output is correct
3 Correct 249 ms 489568 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 245 ms 489628 KB Output is correct
2 Correct 238 ms 489568 KB Output is correct
3 Correct 223 ms 489544 KB Output is correct
4 Correct 291 ms 489540 KB Output is correct
5 Correct 224 ms 489516 KB Output is correct
6 Correct 223 ms 489540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 256 ms 489464 KB Output is correct
2 Correct 634 ms 493572 KB Output is correct
3 Correct 294 ms 493496 KB Output is correct
4 Correct 586 ms 493448 KB Output is correct
5 Correct 287 ms 493496 KB Output is correct
6 Correct 278 ms 493748 KB Output is correct
7 Correct 498 ms 493528 KB Output is correct
8 Correct 272 ms 493592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 230 ms 489552 KB Output is correct
2 Execution timed out 3084 ms 490760 KB Time limit exceeded
3 Halted 0 ms 0 KB -