# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
910848 | 2024-01-18T08:28:26 Z | vjudge1 | Table Tennis (info1cup20_tabletennis) | C++17 | 3000 ms | 5688 KB |
#include <iostream> #include <vector> #include <set> using namespace std; const int NMAX = 150002; int v[NMAX], sum = 0, n, k; vector < int > p, im; int lb(int x){ int st = 1, dr = n + k; while(st < dr){ int mid = (st + dr) / 2; if(v[mid] >= x) dr = mid; else st = mid + 1; } return dr; } bool check(int a){ int SUMA = (sum - a) / 2; int nr = 0, s1 = 0; int st = 1, dr = n + k; if(n % 4 == 0){ ///nr par in feicare gr while(nr < n / 2){ nr += 2; if(v[st] == a) st++; if(v[dr] == a) dr--; s1 += (v[st] + v[dr]); st++, dr--; } if(s1 == SUMA) return true; cout << "s1 ii " << s1 << '\n'; } else{ while(nr < n / 2 - 1){ nr += 2; if(v[st] == a) st++; if(v[dr] == a) dr--; s1 += (v[st] + v[dr]); st++, dr--; } if(v[lb(SUMA - s1)] == SUMA - s1 && st <= lb(SUMA - s1) && lb(SUMA - s1) <= dr) return true; cout << "s1 ii " << s1 << '\n'; } return false; } int solve(vector < int > a){ for(int i = 0; i < a.size(); i++){ if(check(a[i]) == true) return a[i]; cout << a[i] << '\n'; } return -1; } int main() { int remov; cin >> n >> k; for(int i = 1; i <= n + k; i++){ cin >> v[i]; sum += v[i]; if(v[i] % 2 == 0) p.push_back(v[i]); else im.push_back(v[i]); } if(sum % 2 == 1) remov = solve(im); else remov = solve(p); for(int i = 1; i <= n + k; i++){ if(v[i] == remov) continue; cout << v[i] << " "; } return 0; } /*4 1 1 2 3 4 5*/
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Incorrect | 2 ms | 348 KB | Expected integer, but "s1" found |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 53 ms | 1164 KB | Expected integer, but "s1" found |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3057 ms | 5688 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Expected integer, but "s1" found |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Expected integer, but "s1" found |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 600 KB | Expected integer, but "s1" found |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 344 KB | Expected integer, but "s1" found |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Expected integer, but "s1" found |
2 | Halted | 0 ms | 0 KB | - |