# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1072751 | 2024-08-24T04:03:32 Z | ngrace | Koala Game (APIO17_koala) | C++14 | 47 ms | 464 KB |
#include "koala.h" #include<bits/stdc++.h> using namespace std; #define v vector v<int> query(v<int> q){ int R[100],B[100]; for(int i=0;i<q.size();i++) R[i]=q[i]; playRound(R,B); v<int> res(q.size()); for(int i=0;i<q.size();i++)res[i]=B[i]; return res; } int minValue(int N, int W) { v<int> q(N,1); v<int> r = query(q); q = v<int>(N,0); for(int i=0;i<N;i++){ if(r[i]!=0){ q[i]=1; break; } } r = query(q); for(int i=0; i<N; i++){ if(r[i]==0) return i; } } int maxValue(int N, int W) { v<int> poss; for(int i=0;i<N;i++) poss.push_back(i); while(poss.size()>1){ v<int> q(N,0); for(int i:poss) q[i] = (W / (int)poss.size()); v<int> r=query(q); v<int> nposs; for(int i:poss){ if(r[i]>(W/(int)poss.size())) nposs.push_back(i); } poss = nposs; } return poss[0]; } int greaterValueInd(int x, int y){ int l=1,r=9; while(l<=r){ int m=(l+r)/2; v<int> q(100,0); q[x]=m; q[y]=m; v<int> rr = query(q); if(rr[x]>m && rr[y]<=m) return 0; else if(rr[y]>m && rr[x]<=m) return 1; if(rr[x]<=m && rr[y]<=m) r=m-1; else l=m+1; } } int greaterValue(int N, int W) { return greaterValueInd(0, 1); } int comp(int x, int y){ v<int> q(100, 0); q[x] = 100; q[y] = 100; v<int> r = query(q); if(r[x]==0) return 1; else return 0; } void allValues(int N, int W, int *P) { if (W == 2*N) { v<int> ind; for(int i=0; i<N; i++) ind.push_back(i); stable_sort(ind.begin(), ind.end(), comp); for(int i=0; i<N; i++) P[ind[i]] = i+1; } else { v<int> ind; for(int i=0; i<N; i++) ind.push_back(i); stable_sort(ind.begin(), ind.end(), greaterValueInd); for(int i=0; i<N; i++) P[ind[i]] = i+1; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 344 KB | Output is correct |
2 | Correct | 7 ms | 344 KB | Output is correct |
3 | Correct | 5 ms | 452 KB | Output is correct |
4 | Correct | 5 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 344 KB | Output is correct |
2 | Correct | 10 ms | 456 KB | Output is correct |
3 | Correct | 12 ms | 344 KB | Output is correct |
4 | Correct | 11 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 43 ms | 344 KB | Output is correct |
2 | Correct | 47 ms | 460 KB | Output is correct |
3 | Correct | 38 ms | 344 KB | Output is correct |
4 | Correct | 37 ms | 464 KB | Output is correct |
5 | Correct | 38 ms | 344 KB | Output is correct |
6 | Correct | 38 ms | 344 KB | Output is correct |
7 | Correct | 41 ms | 464 KB | Output is correct |
8 | Correct | 42 ms | 344 KB | Output is correct |
9 | Correct | 39 ms | 344 KB | Output is correct |
10 | Correct | 37 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 344 KB | Output is correct |
2 | Correct | 28 ms | 344 KB | Output is correct |
3 | Correct | 28 ms | 344 KB | Output is correct |
4 | Correct | 29 ms | 344 KB | Output is correct |
5 | Correct | 27 ms | 344 KB | Output is correct |
6 | Correct | 28 ms | 344 KB | Output is correct |
7 | Correct | 27 ms | 344 KB | Output is correct |
8 | Correct | 31 ms | 344 KB | Output is correct |
9 | Correct | 28 ms | 344 KB | Output is correct |
10 | Correct | 30 ms | 344 KB | Output is correct |
11 | Correct | 28 ms | 344 KB | Output is correct |
12 | Correct | 14 ms | 344 KB | Output is correct |
13 | Correct | 27 ms | 344 KB | Output is correct |
14 | Correct | 25 ms | 344 KB | Output is correct |
15 | Correct | 25 ms | 344 KB | Output is correct |
16 | Correct | 26 ms | 344 KB | Output is correct |
17 | Correct | 27 ms | 344 KB | Output is correct |
18 | Correct | 25 ms | 344 KB | Output is correct |
19 | Correct | 25 ms | 456 KB | Output is correct |
20 | Correct | 25 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 17 ms | 344 KB | Output is partially correct |
2 | Partially correct | 21 ms | 344 KB | Output is partially correct |
3 | Partially correct | 21 ms | 344 KB | Output is partially correct |
4 | Partially correct | 20 ms | 456 KB | Output is partially correct |
5 | Partially correct | 21 ms | 344 KB | Output is partially correct |
6 | Partially correct | 21 ms | 344 KB | Output is partially correct |
7 | Partially correct | 21 ms | 344 KB | Output is partially correct |
8 | Partially correct | 21 ms | 344 KB | Output is partially correct |
9 | Partially correct | 22 ms | 344 KB | Output is partially correct |
10 | Partially correct | 20 ms | 344 KB | Output is partially correct |
11 | Partially correct | 21 ms | 456 KB | Output is partially correct |
12 | Partially correct | 9 ms | 344 KB | Output is partially correct |
13 | Partially correct | 21 ms | 344 KB | Output is partially correct |
14 | Partially correct | 20 ms | 344 KB | Output is partially correct |
15 | Partially correct | 20 ms | 344 KB | Output is partially correct |
16 | Partially correct | 21 ms | 344 KB | Output is partially correct |
17 | Partially correct | 21 ms | 344 KB | Output is partially correct |
18 | Partially correct | 20 ms | 452 KB | Output is partially correct |
19 | Partially correct | 21 ms | 456 KB | Output is partially correct |
20 | Partially correct | 20 ms | 344 KB | Output is partially correct |
21 | Partially correct | 22 ms | 344 KB | Output is partially correct |
22 | Partially correct | 21 ms | 424 KB | Output is partially correct |
23 | Partially correct | 18 ms | 344 KB | Output is partially correct |
24 | Partially correct | 21 ms | 344 KB | Output is partially correct |
25 | Partially correct | 20 ms | 340 KB | Output is partially correct |
26 | Partially correct | 22 ms | 344 KB | Output is partially correct |
27 | Partially correct | 20 ms | 344 KB | Output is partially correct |
28 | Partially correct | 20 ms | 456 KB | Output is partially correct |
29 | Partially correct | 20 ms | 344 KB | Output is partially correct |
30 | Partially correct | 20 ms | 452 KB | Output is partially correct |
31 | Partially correct | 20 ms | 344 KB | Output is partially correct |
32 | Partially correct | 21 ms | 344 KB | Output is partially correct |
33 | Partially correct | 20 ms | 452 KB | Output is partially correct |
34 | Partially correct | 18 ms | 344 KB | Output is partially correct |
35 | Partially correct | 21 ms | 464 KB | Output is partially correct |
36 | Partially correct | 20 ms | 344 KB | Output is partially correct |
37 | Partially correct | 19 ms | 452 KB | Output is partially correct |
38 | Partially correct | 19 ms | 344 KB | Output is partially correct |
39 | Partially correct | 19 ms | 344 KB | Output is partially correct |
40 | Partially correct | 19 ms | 344 KB | Output is partially correct |