#include <bits/stdc++.h>
#include "koala.h"
using namespace std;
//#define int long long
#define double long double
#define FOR(i,l,r,d) for(int i=(l);i<=(r);i+=(d))
#define szof(x) ((x).size())
#define vi vector<int>
#define pii pair<int,int>
#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define mkp make_pair
const int INF = 2147483647;
const int MOD = 1000000007;
const int mod = 998244353;
const double eps = 1e-12;
int B[100];
int R[100];
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.
FOR(i,0,N-2,1){
B[i] = 0;
}
B[N-1] = 1;
playRound(B, R);
int res = 0;
FOR(i,0,N-1,1){
if(R[i]<=B[i]){
res = i;
}
}
return res;
}
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.
bool isMax[N];
/// Round 0: 100 -> 50
/// Round 1: 50 -> 25
/// Round 2: 25 -> 9
/// Round 3: 9 -> 1
int Maxstone[4] = {1, 2, 4, 11};
FOR(i,0,N-1,1){
isMax[i] = 1;
}
FOR(Round,0,3,1){
FOR(i,0,N-1,1){
if(isMax[i]==1){
B[i] = Maxstone[Round];
}
else{
B[i] = 0;
}
}
playRound(B, R);
FOR(i,0,N-1,1){
if(R[i]>B[i] and isMax[i]==1){
isMax[i] = 1;
}
else{
isMax[i] = 0;
}
}
}
FOR(i,0,N-1,1){
if(isMax[i]){
return i;
}
}
return 0;
}
int greaterValue(int N, int W) {
// TODO: Implement Subtask 3 solution here.
// You may leave this function unmodified if you are not attempting this
// subtask.
FOR(i,2,N-1,1){
B[i] = 0;
}
int lb=1, rb=14, mid;
while(lb<rb){
mid = (lb+rb) / 2;
B[0] = B[1] = mid;
playRound(B, R);
if(R[0]>B[0] and R[1]>B[1]){
lb = mid+1;
}
else if(R[0]<=B[0] and R[1]<=B[1]){
rb = mid-1;
}
else{
if(R[0]>B[0]){
return 0;
}
else{
return 1;
}
}
}
return 0;
}
bool cmp(int n1, int n2){
FOR(i,0,99,1){
B[i] = 0;
}
B[n1] = B[n2] = 100;
playRound(B, R);
return (R[n1]<R[n2]);
}
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.
int rk[100];
FOR(i,0,99,1){
rk[i] = i;
}
sort(rk,rk+100,cmp);
FOR(i,0,99,1){
P[rk[i]] = i + 1;
}
} else {
// TODO: Implement Subtask 5 solution here.
// You may leave this block unmodified if you are not attempting this
// subtask.
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
200 KB |
Output is correct |
2 |
Correct |
5 ms |
200 KB |
Output is correct |
3 |
Correct |
5 ms |
312 KB |
Output is correct |
4 |
Correct |
5 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
316 KB |
Output is correct |
2 |
Correct |
15 ms |
312 KB |
Output is correct |
3 |
Correct |
15 ms |
316 KB |
Output is correct |
4 |
Correct |
15 ms |
308 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
53 ms |
320 KB |
Output is correct |
2 |
Correct |
62 ms |
320 KB |
Output is correct |
3 |
Correct |
49 ms |
316 KB |
Output is correct |
4 |
Correct |
49 ms |
320 KB |
Output is correct |
5 |
Correct |
52 ms |
320 KB |
Output is correct |
6 |
Correct |
51 ms |
332 KB |
Output is correct |
7 |
Correct |
50 ms |
316 KB |
Output is correct |
8 |
Correct |
52 ms |
328 KB |
Output is correct |
9 |
Correct |
52 ms |
332 KB |
Output is correct |
10 |
Correct |
57 ms |
324 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
42 ms |
288 KB |
Output is correct |
2 |
Incorrect |
47 ms |
284 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |