# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
255338 | 2020-07-31T17:41:03 Z | Osama_Alkhodairy | Koala Game (APIO17_koala) | C++17 | 94 ms | 504 KB |
#include <bits/stdc++.h> #include "koala.h" //~ #include "grader.cpp" using namespace std; int n; bool cmp(int i, int j){ int B[n], R[n]; for(int i = 0 ; i < n ; i++){ B[i] = R[i] = 0; } int l = 1, r = 9; while(l <= r){ int mid = (l + r) / 2; B[i] = B[j] = mid; playRound(B, R); if((R[i] > B[i]) == (R[j] > B[j])){ if(R[i] > B[j]) l = mid + 1; else r = mid - 1; } else return R[j] > B[j]; } assert(false); } bool cmp2(int i, int j){ int B[n], R[n]; for(int i = 0 ; i < n ; i++){ B[i] = R[i] = 0; } B[i] = B[j] = 100; playRound(B, R); return R[j] > B[j]; } int minValue(int N, int W) { n = N; int B[n], R[n]; for(int i = 0 ; i < n ; i++){ B[i] = R[i] = 0; } B[0]++; playRound(B, R); for(int i = 0 ; i < n ; i++){ if(B[i] >= R[i]) return i; } return 0; } int maxValue(int N, int W) { n = N; int B[n], R[n]; vector <int> cands; for(int i = 0 ; i < n ; i++){ cands.push_back(i); } while(cands.size() > 1){ for(int i = 0 ; i < n ; i++){ B[i] = R[i] = 0; } int cur = W / cands.size(); for(auto &i : cands) B[i] = cur; playRound(B, R); cands.clear(); for(int i = 0 ; i < n ; i++){ if(B[i] == cur && R[i] > B[i]){ cands.push_back(i); } } } return cands[0]; } int greaterValue(int N, int W) { n = N; if(cmp(0, 1)) return 1; return 0; } void allValues(int N, int W, int *P) { n = N; if (W == 2*N) { vector <int> all; for(int i = 0 ; i < n ; i++){ all.push_back(i); } stable_sort(all.begin(), all.end(), cmp2); for(int i = 0 ; i < n ; i++){ P[all[i]] = i + 1; } } else { vector <int> all; for(int i = 0 ; i < n ; i++){ all.push_back(i); } stable_sort(all.begin(), all.end(), cmp); for(int i = 0 ; i < n ; i++){ P[all[i]] = i + 1; } } }
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 384 KB | Output is correct |
2 | Correct | 6 ms | 384 KB | Output is correct |
3 | Correct | 6 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 18 ms | 384 KB | Output is correct |
2 | Correct | 18 ms | 384 KB | Output is correct |
3 | Correct | 18 ms | 384 KB | Output is correct |
4 | Correct | 18 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 78 ms | 384 KB | Output is correct |
2 | Correct | 94 ms | 404 KB | Output is correct |
3 | Correct | 73 ms | 384 KB | Output is correct |
4 | Correct | 74 ms | 384 KB | Output is correct |
5 | Correct | 76 ms | 384 KB | Output is correct |
6 | Correct | 76 ms | 396 KB | Output is correct |
7 | Correct | 73 ms | 384 KB | Output is correct |
8 | Correct | 80 ms | 412 KB | Output is correct |
9 | Correct | 75 ms | 384 KB | Output is correct |
10 | Correct | 74 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 32 ms | 384 KB | Output is correct |
2 | Correct | 49 ms | 384 KB | Output is correct |
3 | Correct | 49 ms | 384 KB | Output is correct |
4 | Correct | 49 ms | 384 KB | Output is correct |
5 | Correct | 49 ms | 376 KB | Output is correct |
6 | Correct | 48 ms | 384 KB | Output is correct |
7 | Correct | 48 ms | 376 KB | Output is correct |
8 | Correct | 49 ms | 384 KB | Output is correct |
9 | Correct | 49 ms | 384 KB | Output is correct |
10 | Correct | 46 ms | 384 KB | Output is correct |
11 | Correct | 49 ms | 384 KB | Output is correct |
12 | Correct | 21 ms | 384 KB | Output is correct |
13 | Correct | 47 ms | 384 KB | Output is correct |
14 | Correct | 45 ms | 384 KB | Output is correct |
15 | Correct | 42 ms | 384 KB | Output is correct |
16 | Correct | 50 ms | 384 KB | Output is correct |
17 | Correct | 44 ms | 376 KB | Output is correct |
18 | Correct | 47 ms | 384 KB | Output is correct |
19 | Correct | 47 ms | 384 KB | Output is correct |
20 | Correct | 45 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 28 ms | 384 KB | Output is partially correct |
2 | Partially correct | 41 ms | 380 KB | Output is partially correct |
3 | Partially correct | 39 ms | 384 KB | Output is partially correct |
4 | Partially correct | 37 ms | 384 KB | Output is partially correct |
5 | Partially correct | 39 ms | 384 KB | Output is partially correct |
6 | Partially correct | 38 ms | 384 KB | Output is partially correct |
7 | Partially correct | 39 ms | 384 KB | Output is partially correct |
8 | Partially correct | 45 ms | 388 KB | Output is partially correct |
9 | Partially correct | 51 ms | 384 KB | Output is partially correct |
10 | Partially correct | 37 ms | 384 KB | Output is partially correct |
11 | Partially correct | 44 ms | 384 KB | Output is partially correct |
12 | Partially correct | 16 ms | 384 KB | Output is partially correct |
13 | Partially correct | 36 ms | 384 KB | Output is partially correct |
14 | Partially correct | 44 ms | 384 KB | Output is partially correct |
15 | Partially correct | 38 ms | 392 KB | Output is partially correct |
16 | Partially correct | 38 ms | 384 KB | Output is partially correct |
17 | Partially correct | 40 ms | 384 KB | Output is partially correct |
18 | Partially correct | 37 ms | 384 KB | Output is partially correct |
19 | Partially correct | 38 ms | 384 KB | Output is partially correct |
20 | Partially correct | 37 ms | 384 KB | Output is partially correct |
21 | Partially correct | 36 ms | 384 KB | Output is partially correct |
22 | Partially correct | 42 ms | 376 KB | Output is partially correct |
23 | Partially correct | 32 ms | 384 KB | Output is partially correct |
24 | Partially correct | 38 ms | 384 KB | Output is partially correct |
25 | Partially correct | 37 ms | 384 KB | Output is partially correct |
26 | Partially correct | 38 ms | 376 KB | Output is partially correct |
27 | Partially correct | 38 ms | 384 KB | Output is partially correct |
28 | Partially correct | 38 ms | 380 KB | Output is partially correct |
29 | Partially correct | 38 ms | 384 KB | Output is partially correct |
30 | Partially correct | 38 ms | 384 KB | Output is partially correct |
31 | Partially correct | 38 ms | 384 KB | Output is partially correct |
32 | Partially correct | 43 ms | 504 KB | Output is partially correct |
33 | Partially correct | 43 ms | 376 KB | Output is partially correct |
34 | Partially correct | 32 ms | 384 KB | Output is partially correct |
35 | Partially correct | 38 ms | 384 KB | Output is partially correct |
36 | Partially correct | 36 ms | 384 KB | Output is partially correct |
37 | Partially correct | 33 ms | 384 KB | Output is partially correct |
38 | Partially correct | 36 ms | 384 KB | Output is partially correct |
39 | Partially correct | 34 ms | 384 KB | Output is partially correct |
40 | Partially correct | 35 ms | 384 KB | Output is partially correct |