#include "koala.h"
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pb push_back
#define debug(x) cerr<<#x<<"="<<x<<endl
#define pq priority_queue
#define inf 0x3f
#define rep(i,a,b) for (int i=a;i<(b);i++)
#define MP make_pair
#define SZ(x) (int(x.size()))
#define ll long long
#define mod 1000000007
#define ALL(x) x.begin(),x.end()
void inc(int &a,int b) {a=(a+b)%mod;}
void dec(int &a,int b) {a=(a-b+mod)%mod;}
int lowbit(int x) {return x&(-x);}
ll p0w(ll base,ll p) {ll ret=1;while(p>0){if (p%2ll==1ll) ret=ret*base%mod;base=base*base%mod;p/=2ll;}return ret;}
int a[100],b[100];
void playRound(int *B, int *R);
int minValue(int N, int W) {
// TODO: Implement Subtask 1 solution here.
// You may leave this function unmodified if you are not attempting this
// subtask.
memset(a,0,sizeof(a));
a[0]=1;
playRound(a,b);
rep(i,0,N) if (b[i]<=a[i]) return i;
}
int maxValue(int N, int W) {
// TODO: Implement Subtask 2 solution here.
// You may leave this function unmodified if you are not attempting this
// subtask.
return 0;
}
int greaterValue(int N, int W) {
int l=1,r=14;
// while ((1+r)*r/2<N+N-1) r++; r--;
memset(a,0,sizeof(a));
while (l<r) {
int mid=l+r>>1;
a[0]=a[1]=mid;
playRound(a,b);
if (b[0]<=a[0]&&b[1]<=a[1]) r=mid-1;
else if (b[0]>a[0]&&b[1]>a[1]) l=mid+1;
else return b[0]>a[0]?0:1;
}
// TODO: Implement Subtask 3 solution here.
// You may leave this function unmodified if you are not attempting this
// subtask.
}
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 greaterValue(int, int)':
koala.cpp:51:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
51 | int mid=l+r>>1;
| ~^~
koala.cpp: In function 'int minValue(int, int)':
koala.cpp:37:1: warning: control reaches end of non-void function [-Wreturn-type]
37 | }
| ^
koala.cpp: In function 'int greaterValue(int, int)':
koala.cpp:61:1: warning: control reaches end of non-void function [-Wreturn-type]
61 | }
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
200 KB |
Output is correct |
2 |
Correct |
5 ms |
200 KB |
Output is correct |
3 |
Correct |
5 ms |
200 KB |
Output is correct |
4 |
Correct |
5 ms |
200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
59 ms |
328 KB |
Output is correct |
2 |
Correct |
57 ms |
316 KB |
Output is correct |
3 |
Correct |
55 ms |
448 KB |
Output is correct |
4 |
Correct |
51 ms |
328 KB |
Output is correct |
5 |
Correct |
52 ms |
320 KB |
Output is correct |
6 |
Correct |
50 ms |
316 KB |
Output is correct |
7 |
Correct |
52 ms |
324 KB |
Output is correct |
8 |
Correct |
50 ms |
324 KB |
Output is correct |
9 |
Correct |
50 ms |
328 KB |
Output is correct |
10 |
Correct |
49 ms |
328 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |