#include "koala.h"
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<long long,null_type,less_equal<long long>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("O2")
//order_of_key #of elements less than x
// find_by_order kth element
using ll=long long;
using ld=long double;
using pii=pair<ll,ll>;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()),c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const ll maxn=1e5+5;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-6;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
out<<P.f<<' '<<P.s;
return out;
}
template<typename T>
ostream& operator<<(ostream& out,vector<T> V){
REP(i,sz(V)) out<<V[i]<<((i!=sz(V)-1)?" ":"");
return out;
}
ll mult(ll a,ll b){
return a*b%MOD;
}
ll mypow(ll a,ll b){
a%=MOD;
if(a==0) return 0;
if(b<=0) return 1;
ll res=1LL;
while(b){
if(b&1) res=(res*a)%MOD;
a=(a*a)%MOD;
b>>=1;
}
return res;
}
int play[105],ans[105];
int minValue(int n, int w) {
REP(i,n) play[i]=0;
play[0]=1;
playRound(play,ans);
REP(i,n){
if(!ans[i]){
return i;
}
}
}
int maxValue(int n, int W) {
vector<int> v;
REP(i,n) v.pb(i);
while(sz(v)>1){
REP(i,n) play[i]=0;
for(int x:v) play[x]=W/sz(v);
playRound(play,ans);
vector<int> vv;
for(int i:v) if(ans[i]) vv.pb(i);
v=vv;
}
return v[0];
}
int greaterValue(int n, int W) {
REP(i,n) play[i]=0;
play[0]=1,play[1]=1;
playRound(play,ans);
if(ans[0] and ans[1]){
int l=2,r=10;
while(l<r){
int mid=(l+r)/2;
play[0]=mid,play[1]=mid;
playRound(play,ans);
if(ans[0] and ans[1]) l=mid;
else{
if(ans[0]){
return 0;
}
if(ans[1]){
return 1;
}
r=mid-1;
}
}
play[0]=l,play[1]=l;
playRound(play,ans);
if(ans[0]) return 0;
return 1;
}
else{
if(ans[0]) return 0;
return 1;
}
}
void allValues(int N, int W, int *P) {
if (W == 2*N) {
// TODO: Implement Subtask 4 solution here.
// You may leave this block unmodified if you are not attempting this
// subtask.
} else {
// TODO: Implement Subtask 5 solution here.
// You may leave this block unmodified if you are not attempting this
// subtask.
}
}
Compilation message
koala.cpp: In function 'int minValue(int, int)':
koala.cpp:68:1: warning: control reaches end of non-void function [-Wreturn-type]
68 | }
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
324 KB |
Output is correct |
2 |
Correct |
4 ms |
208 KB |
Output is correct |
3 |
Correct |
4 ms |
208 KB |
Output is correct |
4 |
Correct |
4 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
208 KB |
Output is correct |
2 |
Correct |
11 ms |
320 KB |
Output is correct |
3 |
Correct |
12 ms |
320 KB |
Output is correct |
4 |
Correct |
11 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
80 ms |
320 KB |
Output is correct |
2 |
Correct |
84 ms |
328 KB |
Output is correct |
3 |
Correct |
71 ms |
320 KB |
Output is correct |
4 |
Correct |
69 ms |
332 KB |
Output is correct |
5 |
Correct |
76 ms |
320 KB |
Output is correct |
6 |
Correct |
81 ms |
332 KB |
Output is correct |
7 |
Correct |
75 ms |
328 KB |
Output is correct |
8 |
Correct |
69 ms |
328 KB |
Output is correct |
9 |
Correct |
73 ms |
456 KB |
Output is correct |
10 |
Correct |
67 ms |
328 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
292 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |