# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
745567 |
2023-05-20T11:40:10 Z |
grogu |
Koala Game (APIO17_koala) |
C++14 |
|
73 ms |
464 KB |
#include "koala.h"
#define here cerr<<"===========================================\n"
#define dbg(x) cerr<<#x<<": "<<x<<endl;
#include <bits/stdc++.h>
#define ld double
#define ll long long
#define ull unsigned long long
#define llinf 100000000000000000LL // 10^17
#define iinf 2000000000 // 2*10^9
#define pb push_back
#define popb pop_back
#define fi first
#define sc second
#define endl '\n'
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pld pair<ld,ld>
#define all(a) a.begin(),a.end()
#define ceri(a,l,r) {cerr<<#a<<": ";for(ll i_ = l;i_<=r;i_++) cerr<<a[i_]<< " ";cerr<<endl;}
#define cer(a) {cerr<<#a<<": ";for(ll x_ : a) cerr<<x_<< " ";cerr<<endl;}
using namespace std;
int B[100];
int R[100];
int minValue(int N, int W){
B[0] = 1;
for(int i=1;i<=99;i++){
B[i] = 0;
}
playRound(B,R);
for(int i=0;i<=99;i++){
if(R[i]==0){
return i;
}
}
return 0;
}
int maxValue(int N, int W){
vector<int> curr;
for(int i=0;i<=99;i++){
curr.push_back(i);
}
while(curr.size()>1){
for(int i=0;i<=99;i++){
B[i] = 0;
}
int cnt = 100/curr.size();
for(int i:curr){
B[i] = cnt;
}
playRound(B,R);
vector<int> curr2;
for(int i:curr){
if(R[i]>B[i]){
curr2.push_back(i);
}
}
curr = curr2;
}
return curr[0];
}
int greaterValue(int N, int W){
int low=0,high=6;
vector<int> v = {1,2,3,4,5,6,8};
while(1){
int mid = (low+high)/2;
for(int i=0;i<=99;i++){
B[i] = 0;
}
B[0] = v[mid];
B[1] = v[mid];
playRound(B,R);
if(R[0]>B[0] and R[1]>B[1]){
low = mid+1;
}
else if(R[0]<=B[0] and R[1]<=B[1]){
high = mid-1;
}
else if(R[0]>B[0]){
return 0;
}
else{
return 1;
}
}
return 0;
}
void reshi(vector<ll> v,int n,int w,int *ans,int l,int r){
if(l==r) ans[v[0]] = l;
else{
int len = r-l+1;
int c = (int)(sqrt(2*l));
c = min(c,r-1);
c = min(c,w/len);
//dbg(c);
for(ll i = 0;i<100;i++) B[i] = 0;
for(ll x : v) B[x] = c;
playRound(B,R);
vector<ll> le,gr;
for(ll x : v){
if(R[x]>c) gr.pb(x);
else le.pb(x);
}
reshi(le,n,w,ans,l,l+le.size()-1);
reshi(gr,n,w,ans,r-gr.size()+1,r);
}
}
void allValues(int N, int W, int *P) {
vector<ll> v(N);
iota(all(v),0);
reshi(v,N,W,P,1,N);
return;
}
/**
4 1
6 6
5 3 2 1 6 4
**/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
208 KB |
Output is correct |
2 |
Correct |
6 ms |
208 KB |
Output is correct |
3 |
Correct |
4 ms |
324 KB |
Output is correct |
4 |
Correct |
4 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
208 KB |
Output is correct |
2 |
Correct |
12 ms |
320 KB |
Output is correct |
3 |
Correct |
12 ms |
208 KB |
Output is correct |
4 |
Correct |
12 ms |
320 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
73 ms |
328 KB |
Output is correct |
2 |
Correct |
65 ms |
328 KB |
Output is correct |
3 |
Correct |
55 ms |
328 KB |
Output is correct |
4 |
Correct |
56 ms |
336 KB |
Output is correct |
5 |
Correct |
56 ms |
336 KB |
Output is correct |
6 |
Correct |
61 ms |
332 KB |
Output is correct |
7 |
Correct |
66 ms |
324 KB |
Output is correct |
8 |
Correct |
63 ms |
324 KB |
Output is correct |
9 |
Correct |
54 ms |
340 KB |
Output is correct |
10 |
Correct |
55 ms |
328 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
464 KB |
Execution killed with signal 8 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
208 KB |
Output is correct |
2 |
Correct |
3 ms |
208 KB |
Output is correct |
3 |
Correct |
3 ms |
208 KB |
Output is correct |
4 |
Correct |
4 ms |
336 KB |
Output is correct |
5 |
Correct |
5 ms |
208 KB |
Output is correct |
6 |
Correct |
3 ms |
312 KB |
Output is correct |
7 |
Correct |
5 ms |
208 KB |
Output is correct |
8 |
Correct |
3 ms |
212 KB |
Output is correct |
9 |
Correct |
3 ms |
208 KB |
Output is correct |
10 |
Correct |
3 ms |
336 KB |
Output is correct |
11 |
Correct |
3 ms |
208 KB |
Output is correct |
12 |
Correct |
3 ms |
208 KB |
Output is correct |
13 |
Correct |
4 ms |
208 KB |
Output is correct |
14 |
Correct |
3 ms |
208 KB |
Output is correct |
15 |
Correct |
3 ms |
336 KB |
Output is correct |
16 |
Correct |
5 ms |
208 KB |
Output is correct |
17 |
Correct |
3 ms |
324 KB |
Output is correct |
18 |
Correct |
3 ms |
208 KB |
Output is correct |
19 |
Correct |
3 ms |
208 KB |
Output is correct |
20 |
Correct |
3 ms |
208 KB |
Output is correct |
21 |
Correct |
4 ms |
208 KB |
Output is correct |
22 |
Correct |
3 ms |
208 KB |
Output is correct |
23 |
Correct |
3 ms |
208 KB |
Output is correct |
24 |
Correct |
3 ms |
208 KB |
Output is correct |
25 |
Correct |
3 ms |
208 KB |
Output is correct |
26 |
Correct |
3 ms |
208 KB |
Output is correct |
27 |
Correct |
3 ms |
324 KB |
Output is correct |
28 |
Correct |
3 ms |
208 KB |
Output is correct |
29 |
Correct |
3 ms |
336 KB |
Output is correct |
30 |
Correct |
3 ms |
208 KB |
Output is correct |
31 |
Correct |
3 ms |
208 KB |
Output is correct |
32 |
Correct |
3 ms |
336 KB |
Output is correct |
33 |
Correct |
3 ms |
208 KB |
Output is correct |
34 |
Correct |
3 ms |
208 KB |
Output is correct |
35 |
Correct |
5 ms |
208 KB |
Output is correct |
36 |
Correct |
3 ms |
208 KB |
Output is correct |
37 |
Correct |
3 ms |
208 KB |
Output is correct |
38 |
Correct |
3 ms |
328 KB |
Output is correct |
39 |
Correct |
3 ms |
336 KB |
Output is correct |
40 |
Correct |
3 ms |
208 KB |
Output is correct |