Submission #717382

# Submission time Handle Problem Language Result Execution time Memory
717382 2023-04-01T22:06:18 Z vjudge1 Table Tennis (info1cup20_tabletennis) C++17
Compilation error
0 ms 0 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;
    
    unorderd_map<int,bool> 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:16:5: error: 'unorderd_map' was not declared in this scope
   16 |     unorderd_map<int,bool> in;
      |     ^~~~~~~~~~~~
tabletennis.cpp:4:13: error: expected primary-expression before 'long'
    4 | #define int long long
      |             ^~~~
tabletennis.cpp:16:18: note: in expansion of macro 'int'
   16 |     unorderd_map<int,bool> in;
      |                  ^~~
tabletennis.cpp:19:9: error: 'in' was not declared in this scope; did you mean 'i'?
   19 |         in[arr[i]] = true;
      |         ^~
      |         i
tabletennis.cpp:29:42: error: 'in' was not declared in this scope; did you mean 'i'?
   29 |                 if (sum - arr[l] >= 0 && in[sum - arr[l]]) {
      |                                          ^~
      |                                          i
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) {
      |                 ~~~~~~~~~~~~^~~~