# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
118986 | 2019-06-20T07:03:43 Z | Mahdi_Jfri | Koala Game (APIO17_koala) | C++14 | 88 ms | 504 KB |
#include "koala.h" #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back const int maxn = 1e2 + 20; int b[maxn] , r[maxn] , ind[maxn]; bool can[maxn]; int minValue(int n, int w) { memset(b , 0 , sizeof b); b[0] = 1; playRound(b , r); if(r[0] != 2) return 0; for(int i = 1; i < n - 1; i++) if(!r[i]) return i; } int maxValue(int n, int w) { for(int i = 0; i < n; i++) can[i] = 1; int rem = n; while(rem > 1) { for(int i = 0; i < n; i++) { if(can[i]) b[i] = w / rem; else b[i] = 0; } playRound(b , r); for(int i = 0; i < n; i++) if(can[i] && r[i] <= b[i]) can[i] = 0 , rem--; } for(int i = 0; i < n; i++) if(can[i]) return i; } bool f; bool cmp(int p1 , int p2) { int l = 1 , rx = 14; while(1) { memset(b , 0 , sizeof b); int m = (l + rx) / 2; b[p1] = b[p2] = m; if(f) for(int i = 0; i < 100; i++) b[i]++; playRound(b , r); if(b[p1] < r[p1] && b[p2] < r[p2]) { l = m + 1; continue; } if(b[p1] < r[p1] && b[p2] >= r[p2]) return 0; if(b[p1] >= r[p1] && b[p2] < r[p2]) return 1; rx = m - 1; } } int greaterValue(int n, int w) { return cmp(0 , 1); } void allValues(int n, int w, int *p) { if (w == 2*n) { for(int i = 0; i < n; i++) ind[i] = i; f = 1; sort(ind , ind + n , cmp); for(int i = 0; i < n; i++) p[ind[i]] = i + 1; sort(ind , ind + n , cmp); } else { for(int i = 0; i < n; i++) ind[i] = i; sort(ind , ind + n , cmp); for(int i = 0; i < n; i++) p[ind[i]] = i + 1; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 384 KB | Output is correct |
2 | Correct | 14 ms | 384 KB | Output is correct |
3 | Correct | 13 ms | 384 KB | Output is correct |
4 | Correct | 13 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 42 ms | 476 KB | Output is correct |
2 | Correct | 48 ms | 384 KB | Output is correct |
3 | Correct | 42 ms | 384 KB | Output is correct |
4 | Correct | 42 ms | 384 KB | Output is correct |
5 | Correct | 88 ms | 384 KB | Output is correct |
6 | Correct | 43 ms | 384 KB | Output is correct |
7 | Correct | 43 ms | 468 KB | Output is correct |
8 | Correct | 44 ms | 384 KB | Output is correct |
9 | Correct | 44 ms | 456 KB | Output is correct |
10 | Correct | 44 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 35 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 23 ms | 384 KB | Output is partially correct |
2 | Partially correct | 28 ms | 372 KB | Output is partially correct |
3 | Partially correct | 26 ms | 384 KB | Output is partially correct |
4 | Partially correct | 26 ms | 384 KB | Output is partially correct |
5 | Partially correct | 29 ms | 384 KB | Output is partially correct |
6 | Partially correct | 26 ms | 384 KB | Output is partially correct |
7 | Partially correct | 27 ms | 376 KB | Output is partially correct |
8 | Partially correct | 28 ms | 376 KB | Output is partially correct |
9 | Partially correct | 27 ms | 376 KB | Output is partially correct |
10 | Partially correct | 24 ms | 384 KB | Output is partially correct |
11 | Partially correct | 25 ms | 384 KB | Output is partially correct |
12 | Partially correct | 18 ms | 384 KB | Output is partially correct |
13 | Partially correct | 27 ms | 384 KB | Output is partially correct |
14 | Partially correct | 25 ms | 384 KB | Output is partially correct |
15 | Partially correct | 29 ms | 384 KB | Output is partially correct |
16 | Partially correct | 28 ms | 384 KB | Output is partially correct |
17 | Partially correct | 32 ms | 504 KB | Output is partially correct |
18 | Partially correct | 30 ms | 416 KB | Output is partially correct |
19 | Partially correct | 27 ms | 384 KB | Output is partially correct |
20 | Partially correct | 27 ms | 376 KB | Output is partially correct |
21 | Partially correct | 35 ms | 384 KB | Output is partially correct |
22 | Partially correct | 28 ms | 384 KB | Output is partially correct |
23 | Partially correct | 22 ms | 384 KB | Output is partially correct |
24 | Partially correct | 28 ms | 384 KB | Output is partially correct |
25 | Partially correct | 29 ms | 376 KB | Output is partially correct |
26 | Partially correct | 30 ms | 376 KB | Output is partially correct |
27 | Partially correct | 27 ms | 376 KB | Output is partially correct |
28 | Partially correct | 27 ms | 376 KB | Output is partially correct |
29 | Partially correct | 27 ms | 384 KB | Output is partially correct |
30 | Partially correct | 26 ms | 376 KB | Output is partially correct |
31 | Partially correct | 26 ms | 384 KB | Output is partially correct |
32 | Partially correct | 27 ms | 384 KB | Output is partially correct |
33 | Partially correct | 26 ms | 384 KB | Output is partially correct |
34 | Partially correct | 23 ms | 384 KB | Output is partially correct |
35 | Partially correct | 26 ms | 384 KB | Output is partially correct |
36 | Partially correct | 25 ms | 476 KB | Output is partially correct |
37 | Partially correct | 26 ms | 384 KB | Output is partially correct |
38 | Partially correct | 28 ms | 384 KB | Output is partially correct |
39 | Partially correct | 26 ms | 384 KB | Output is partially correct |
40 | Partially correct | 27 ms | 384 KB | Output is partially correct |