Submission #745790

# Submission time Handle Problem Language Result Execution time Memory
745790 2023-05-21T07:48:24 Z vjudge1 Table Tennis (info1cup20_tabletennis) C++17
0 / 100
3000 ms 65940 KB
#include <bits/stdc++.h>
using namespace std;
map<int, int> m;
vector<int> scores;
int n, k;

bool possible(int a, int b){
    int sum = scores[a] + scores[b];
    vector<int> square;
    for (int i=a; i<n+k; i++){
        if (scores[i] * 2 < sum && m[sum - scores[i]]){
            square.push_back(scores[i]);
        }
    }
    if (square.size() < n/2) return false;
    for (int i=0; i<n/2; i++){
        cout << square[i] << " ";
    }
    for (int i=0; i<n/2; i++){
        cout << sum - square[i] << " ";
    }
}

int main()
{
    cin >> n >> k;
    scores.resize(n+k);
    for (int i=0; i<n+k; i++){
        cin >> scores[i];
        m[scores[i]]++;
    }
    for (int i=0; i<=k; i++){
        for (int j=i+1; j<n+k; j++){
            if (possible(i, j)){
                return 0;
            }
        }
    }
}

Compilation message

tabletennis.cpp: In function 'bool possible(int, int)':
tabletennis.cpp:15:23: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   15 |     if (square.size() < n/2) return false;
      |         ~~~~~~~~~~~~~~^~~~~
tabletennis.cpp:9:17: warning: control reaches end of non-void function [-Wreturn-type]
    9 |     vector<int> square;
      |                 ^~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 460 ms 65940 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3018 ms 1772 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3075 ms 36624 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 424 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 428 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -