# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1075427 | 2024-08-26T05:57:01 Z | HappyCapybara | Koala Game (APIO17_koala) | C++17 | 39 ms | 600 KB |
#include "koala.h" #include<bits/stdc++.h> using namespace std; int minValue(int N, int W) { int B[N], R[N]; for (int i=0; i<N; i++) B[i] = 0; B[0] = 1; playRound(B, R); for (int i=0; i<N; i++){ if (B[i] >= R[i]) return i; } } int maxValue(int N, int W) { int B[N], R[N]; for (int i=0; i<N; i++) B[i] = 1; playRound(B, R); vector<int> v; for (int i=0; i<N; i++){ if (R[i] > 1) v.push_back(i); } //cout << v.size() << "\n"; for (int i=0; i<N; i++) B[i] = 0; for (int x : v) B[x] = 2; playRound(B, R); vector<int> w; for (int x : v){ if (R[x] > 2) w.push_back(x); } //cout << w.size() << "\n"; for (int i=0; i<N; i++) B[i] = 0; for (int x : w) B[x] = 4; playRound(B, R); vector<int> u; for (int x : w){ if (R[x] > 4) u.push_back(x); } //cout << u.size() << "\n"; for (int i=0; i<N; i++) B[i] = 0; for (int x : u) B[x] = 11; playRound(B, R); for (int x : u){ if (R[x] > 11) return x; } } int greaterValue(int N, int W) { int B[N], R[N]; for (int i=0; i<N; i++) B[i] = 0; int l = 0, r = 13; while (l != r){ int m = (l+r)/2; B[0] = m; B[1] = m; playRound(B, R); if (R[0] > B[0] && R[1] > B[1]) l = m; if (R[0] <= B[0] && R[1] <= B[1]) r = m; if (R[0] > B[0] && R[1] <= B[1]) return 0; if (R[0] <= B[0] && R[1] > B[1]) return 1; } } int comp(int a, int b){ int N = 100; int B[N], R[N]; for (int i=0; i<N; i++) B[i] = 0; int l = 0, r = 13; while (l != r){ int m = (l+r)/2; B[a] = m; B[b] = m; playRound(B, R); if (R[a] > B[a] && R[b] > B[b]) l = m; if (R[a] <= B[a] && R[b] <= B[b]) r = m; if (R[a] > B[a] && R[b] <= B[b]) return 0; if (R[a] <= B[a] && R[b] > B[b]) return 1; } } vector<int> sort2(vector<int> v){ if (v.size() == 1) return v; if (v.size() == 2){ if (comp(v[0], v[1])) return v; else return {v[1], v[0]}; } int l = v.size()/2; int r = v.size()-l; vector<int> a(l); vector<int> b(r); for (int i=0; i<l; i++) a[i] = v[i]; for (int i=0; i<r; i++) b[i] = v[i+l]; a = sort2(a); b = sort2(b); vector<int> w; int c = 0, d = 0; while (c+d < l+r){ if (c == l){ w.push_back(b[d]); d++; continue; } if (d == r){ w.push_back(a[c]); c++; continue; } if (comp(a[c], b[d])){ w.push_back(a[c]); c++; } else { w.push_back(b[d]); d++; } } return w; } void allValues(int N, int W, int *P) { if (W == 2*N){ } else { vector<int> v(100); for (int i=0; i<100; i++) v[i] = i; vector<int> w = sort2(v); for (int i=0; i<N; i++) P[w[i]] = i+1; return; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 344 KB | Output is correct |
2 | Correct | 3 ms | 344 KB | Output is correct |
3 | Correct | 4 ms | 344 KB | Output is correct |
4 | Correct | 3 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 344 KB | Output is correct |
2 | Correct | 10 ms | 448 KB | Output is correct |
3 | Correct | 10 ms | 344 KB | Output is correct |
4 | Correct | 9 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 34 ms | 596 KB | Output is correct |
2 | Correct | 39 ms | 344 KB | Output is correct |
3 | Correct | 39 ms | 344 KB | Output is correct |
4 | Correct | 34 ms | 344 KB | Output is correct |
5 | Correct | 38 ms | 600 KB | Output is correct |
6 | Correct | 37 ms | 344 KB | Output is correct |
7 | Correct | 34 ms | 344 KB | Output is correct |
8 | Correct | 35 ms | 344 KB | Output is correct |
9 | Correct | 37 ms | 344 KB | Output is correct |
10 | Correct | 33 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 11 ms | 344 KB | Output is partially correct |
2 | Partially correct | 17 ms | 344 KB | Output is partially correct |
3 | Partially correct | 17 ms | 344 KB | Output is partially correct |
4 | Partially correct | 17 ms | 344 KB | Output is partially correct |
5 | Partially correct | 17 ms | 344 KB | Output is partially correct |
6 | Partially correct | 16 ms | 344 KB | Output is partially correct |
7 | Partially correct | 16 ms | 344 KB | Output is partially correct |
8 | Partially correct | 16 ms | 344 KB | Output is partially correct |
9 | Partially correct | 16 ms | 344 KB | Output is partially correct |
10 | Partially correct | 16 ms | 344 KB | Output is partially correct |
11 | Partially correct | 16 ms | 344 KB | Output is partially correct |
12 | Partially correct | 10 ms | 456 KB | Output is partially correct |
13 | Partially correct | 16 ms | 344 KB | Output is partially correct |
14 | Partially correct | 16 ms | 344 KB | Output is partially correct |
15 | Partially correct | 16 ms | 344 KB | Output is partially correct |
16 | Partially correct | 17 ms | 344 KB | Output is partially correct |
17 | Partially correct | 17 ms | 344 KB | Output is partially correct |
18 | Partially correct | 19 ms | 456 KB | Output is partially correct |
19 | Partially correct | 17 ms | 344 KB | Output is partially correct |
20 | Partially correct | 18 ms | 456 KB | Output is partially correct |
21 | Partially correct | 17 ms | 344 KB | Output is partially correct |
22 | Partially correct | 16 ms | 344 KB | Output is partially correct |
23 | Partially correct | 14 ms | 344 KB | Output is partially correct |
24 | Partially correct | 21 ms | 596 KB | Output is partially correct |
25 | Partially correct | 16 ms | 344 KB | Output is partially correct |
26 | Partially correct | 16 ms | 344 KB | Output is partially correct |
27 | Partially correct | 16 ms | 344 KB | Output is partially correct |
28 | Partially correct | 16 ms | 448 KB | Output is partially correct |
29 | Partially correct | 16 ms | 344 KB | Output is partially correct |
30 | Partially correct | 16 ms | 344 KB | Output is partially correct |
31 | Partially correct | 16 ms | 344 KB | Output is partially correct |
32 | Partially correct | 16 ms | 344 KB | Output is partially correct |
33 | Partially correct | 17 ms | 344 KB | Output is partially correct |
34 | Partially correct | 16 ms | 344 KB | Output is partially correct |
35 | Partially correct | 16 ms | 344 KB | Output is partially correct |
36 | Partially correct | 15 ms | 340 KB | Output is partially correct |
37 | Partially correct | 15 ms | 344 KB | Output is partially correct |
38 | Partially correct | 15 ms | 452 KB | Output is partially correct |
39 | Partially correct | 15 ms | 452 KB | Output is partially correct |
40 | Partially correct | 15 ms | 452 KB | Output is partially correct |