#include "koala.h"
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define foru(i, l, r) for(int i = l; i <= r; i++)
#define ford(i, r, l) for(int i = r; i >= l; i--)
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
//const int N = ;
const int oo = 1e18 + 7, mod = 1e9 + 7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l, int r){
int temp = rng() % (r - l + 1);
temp = (temp + (r - l + 1)) % (r - l + 1);
return temp + l;
}
int n;
int B[105], R[105];
int minValue(int N, int W) {
//int B[105], R[105];
for(int i = 0; i < N; i++) B[i] = 0;
B[0] = 1;
playRound(B, R);
//for(int i = 0; i < N; i++) cout << B[i] << " " << R[i] << "\n";
for(int i = 0; i < N; i++) if(R[i] <= B[i]) return i;
//return;
}
int maxValue(int N, int W) {
vector<int> rem;
for(int i = 0; i < N; i++) rem.pb(i);
while(rem.size() > 1){
//cout << rem.size() << "\n";
int temp = W / rem.size();
//cout << temp << "\n";
//cout << rem.size() << "\n";
//for(auto it : rem) cout << it << " ";
//cout << "\n";
for(int i = 0; i < N; i++) B[i] = 0;
for(auto it : rem) B[it] = temp;
playRound(B, R);
vector<int> vc;
for(auto it : rem) if(R[it] > B[it] && B[it]) vc.pb(it);
rem = vc;
}
return rem[0];
}
int cnt = 0;
int greaterValue(int N, int W) {
n = N;
int l = 0, r = 15;
while(l <= r){
int mid = (l + r) >> 1;
for(int i = 0; i < n; i++) B[i] = 0;
B[0] = B[1] = mid;
playRound(B, R);
bool ck1 = (R[0] > B[0]), ck2 = (R[1] > B[1]);
if(ck1 ^ ck2) return !ck1;
if(!ck1) r = mid - 1;
else l = mid + 1;
}
return 0;
}
bool used[105];
void allValues(int N, int W, int *P) {
n = N;
for(int itr = n; itr >= 1; itr--){
vector<int> rem;
for(int i = 0; i < n; i++) if(!used[i]) rem.pb(i);
while(rem.size() > 1){
//cout << rem.size() << "\n";
int temp = W / rem.size();
//cout << temp << "\n";
//cout << rem.size() << "\n";
//for(auto it : rem) cout << it << " ";
//cout << "\n";
for(int i = 0; i < n; i++) B[i] = 0;
for(auto it : rem) B[it] = temp;
playRound(B, R);
vector<int> vc;
for(auto it : rem) if(R[it] > B[it] && B[it]) vc.pb(it);
rem = vc;
}
used[rem[0]] = 1;
P[rem[0]] = itr;
}
//return 0;
}
/*
void process(){
}
signed main(){
ios_base::sync_with_stdio(0);
process();
}*/
Compilation message
koala.cpp:19:21: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
19 | const int oo = 1e18 + 7, mod = 1e9 + 7;
| ~~~~~^~~
koala.cpp: In function 'int minValue(int, int)':
koala.cpp:40:1: warning: control reaches end of non-void function [-Wreturn-type]
40 | }
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
208 KB |
Output is correct |
2 |
Correct |
4 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 |
12 ms |
208 KB |
Output is correct |
2 |
Correct |
11 ms |
208 KB |
Output is correct |
3 |
Correct |
12 ms |
324 KB |
Output is correct |
4 |
Correct |
11 ms |
324 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
48 ms |
336 KB |
Output is correct |
2 |
Correct |
59 ms |
328 KB |
Output is correct |
3 |
Correct |
47 ms |
452 KB |
Output is correct |
4 |
Correct |
43 ms |
352 KB |
Output is correct |
5 |
Correct |
43 ms |
336 KB |
Output is correct |
6 |
Correct |
41 ms |
336 KB |
Output is correct |
7 |
Correct |
42 ms |
332 KB |
Output is correct |
8 |
Correct |
42 ms |
332 KB |
Output is correct |
9 |
Correct |
43 ms |
336 KB |
Output is correct |
10 |
Correct |
42 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
39 ms |
296 KB |
Output is correct |
2 |
Correct |
32 ms |
208 KB |
Output is correct |
3 |
Correct |
32 ms |
300 KB |
Output is correct |
4 |
Correct |
32 ms |
208 KB |
Output is correct |
5 |
Correct |
33 ms |
208 KB |
Output is correct |
6 |
Correct |
31 ms |
208 KB |
Output is correct |
7 |
Correct |
38 ms |
296 KB |
Output is correct |
8 |
Correct |
33 ms |
300 KB |
Output is correct |
9 |
Correct |
34 ms |
300 KB |
Output is correct |
10 |
Correct |
32 ms |
208 KB |
Output is correct |
11 |
Correct |
32 ms |
208 KB |
Output is correct |
12 |
Correct |
31 ms |
208 KB |
Output is correct |
13 |
Correct |
40 ms |
300 KB |
Output is correct |
14 |
Correct |
31 ms |
208 KB |
Output is correct |
15 |
Correct |
32 ms |
208 KB |
Output is correct |
16 |
Correct |
34 ms |
208 KB |
Output is correct |
17 |
Correct |
31 ms |
308 KB |
Output is correct |
18 |
Correct |
33 ms |
208 KB |
Output is correct |
19 |
Correct |
32 ms |
208 KB |
Output is correct |
20 |
Correct |
32 ms |
320 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
208 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |