# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
895619 | 2023-12-30T11:48:45 Z | Tenis0206 | Koala Game (APIO17_koala) | C++11 | 17 ms | 684 KB |
#include <bits/stdc++.h> #include "koala.h" using namespace std; const int nmax = 100; int n; int b[nmax + 5], r[nmax + 5]; int paux[nmax + 5]; bool sel[nmax + 5]; int find_value(int poz, int W) { int st = 1; int dr = n; int rez = 0; while(st<=dr) { int mij = (st + dr) >> 1; for(int i=0; i<n; i++) { r[i] = 0, b[i] = 0; } if(W == 200) { for(int i=0; i<n; i++) { b[i] = 1; } } for(int i=0; i<mij; i++) { ++b[i]; } playRound(b,r); if(r[poz] <= b[poz]) { dr = mij - 1; rez = mij; } else { st = mij + 1; } } return rez; } /*int comp(int pa, int pb) { int st = 1; int dr = n - 2; int rez = 0; while(st<=dr) { int mij = (st + dr) >> 1; for(int i=0;i<n;i++) { r[i] = 0, b[i] = 0; } if(W == 200) { for(int i=0;i<n;i++) { b[i] = 1; } } int nr = 0; for(int i=0;i<n && nr < mij;i++) { if(i == pa || i == pb) { continue; } ++b[i]; ++nr; } playRound(b,r); if(r[pa] <= b[pa] && r[pb] > b[pb]) { return pb; } if(r[pb] <= ) if(r[poz] <= b[poz]) { dr = mij - 1; rez = mij; } else { st = mij + 1; } } return rez; } */ int minValue(int N, int W) { n = N; for(int i=0; i<n; i++) { b[i] = 0; r[i] = 0; } b[0] = 1; playRound(b,r); for(int i=0; i<n; i++) { if(r[i] <= b[i]) { return i; } } return 0; } int maxValue(int N, int W) { n = N; vector<int> c; for(int i=0; i<n; i++) { c.push_back(i); } int nr = 0; while(true) { ++nr; while((nr + 1) * (int)(c.size()) <= W) { ++nr; } for(int i=0; i<n; i++) { b[i] = 0, r[i] = 0; } for(auto it : c) { b[it] = nr; } playRound(b,r); vector<int> aux; for(auto it : c) { if(r[it] > b[it]) { aux.push_back(it); } } c = aux; if(c.size() == 1) { return c.front(); } } return 0; } int greaterValue(int N, int W) { return 0; //return comp(0,1,W); } void allValues(int N, int W, int *P) { n = N; #ifdef home ifstream f("nr.in"); int a,bb,c,d; f>>a>>bb>>c>>d; for(int i=0; i<n; i++) { f>>paux[i]; } #endif // home if (W == 2*N) { // TODO: Implement Subtask 4 solution here. // You may leave this block unmodified if you are not attempting this // subtask. } else { for(int i=0;i<n;i++) { sel[i] = false; } for(int val=n; val>=2; val--) { vector<int> c; for(int i=0; i<n; i++) { if(sel[i]) { continue; } c.push_back(i); } int poz = 0; int nr = 0; while(true) { ++nr; /*while((nr + 1) * (int)(c.size()) <= W) { ++nr; } */ for(int i=0; i<n; i++) { b[i] = 0, r[i] = 0; } for(auto it : c) { b[it] = nr; } playRound(b,r); vector<int> aux; for(auto it : c) { if(r[it] > b[it]) { aux.push_back(it); } } c = aux; if(c.size() == 1) { poz = c.front(); break; } } P[poz] = val; sel[poz] = true; } for(int i=0;i<n;i++) { if(!sel[i]) { P[i] = 1; } } } }
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 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 | 456 KB | Output is correct |
2 | Correct | 11 ms | 344 KB | Output is correct |
3 | Correct | 10 ms | 344 KB | Output is correct |
4 | Correct | 10 ms | 456 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 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 16 ms | 500 KB | Output is partially correct |
2 | Partially correct | 13 ms | 344 KB | Output is partially correct |
3 | Partially correct | 14 ms | 452 KB | Output is partially correct |
4 | Partially correct | 13 ms | 344 KB | Output is partially correct |
5 | Partially correct | 15 ms | 684 KB | Output is partially correct |
6 | Partially correct | 13 ms | 344 KB | Output is partially correct |
7 | Partially correct | 13 ms | 344 KB | Output is partially correct |
8 | Partially correct | 13 ms | 344 KB | Output is partially correct |
9 | Partially correct | 14 ms | 448 KB | Output is partially correct |
10 | Partially correct | 13 ms | 344 KB | Output is partially correct |
11 | Partially correct | 17 ms | 344 KB | Output is partially correct |
12 | Partially correct | 12 ms | 344 KB | Output is partially correct |
13 | Partially correct | 13 ms | 344 KB | Output is partially correct |
14 | Partially correct | 13 ms | 344 KB | Output is partially correct |
15 | Partially correct | 13 ms | 344 KB | Output is partially correct |
16 | Partially correct | 13 ms | 344 KB | Output is partially correct |
17 | Partially correct | 13 ms | 340 KB | Output is partially correct |
18 | Partially correct | 13 ms | 344 KB | Output is partially correct |
19 | Partially correct | 17 ms | 452 KB | Output is partially correct |
20 | Partially correct | 13 ms | 344 KB | Output is partially correct |
21 | Partially correct | 13 ms | 344 KB | Output is partially correct |
22 | Partially correct | 13 ms | 344 KB | Output is partially correct |
23 | Partially correct | 13 ms | 512 KB | Output is partially correct |
24 | Partially correct | 13 ms | 344 KB | Output is partially correct |
25 | Partially correct | 13 ms | 448 KB | Output is partially correct |
26 | Partially correct | 13 ms | 456 KB | Output is partially correct |
27 | Partially correct | 13 ms | 344 KB | Output is partially correct |
28 | Partially correct | 17 ms | 600 KB | Output is partially correct |
29 | Partially correct | 13 ms | 344 KB | Output is partially correct |
30 | Partially correct | 13 ms | 344 KB | Output is partially correct |
31 | Partially correct | 13 ms | 344 KB | Output is partially correct |
32 | Partially correct | 13 ms | 344 KB | Output is partially correct |
33 | Partially correct | 13 ms | 344 KB | Output is partially correct |
34 | Partially correct | 13 ms | 344 KB | Output is partially correct |
35 | Partially correct | 15 ms | 452 KB | Output is partially correct |
36 | Partially correct | 13 ms | 448 KB | Output is partially correct |
37 | Partially correct | 14 ms | 600 KB | Output is partially correct |
38 | Partially correct | 13 ms | 344 KB | Output is partially correct |
39 | Partially correct | 15 ms | 504 KB | Output is partially correct |
40 | Partially correct | 14 ms | 344 KB | Output is partially correct |