#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair <int, int>
#define X first
#define Y second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define info() cerr << __PRETTY_FUNCTION__ << ": " << __LINE__ << endl
void abc() {cerr << endl;}
template <typename T, typename ...U> void abc(T a, U ...b) {
cerr << a << ' ', abc(b...);
}
template <typename T> void printv(T l, T r) {
while (l != r) cout << *l << " \n"[++l == r];
}
template <typename A, typename B> istream& operator >> (istream& o, pair<A, B> &a) {
return o >> a.X >> a.Y;
}
template <typename A, typename B> ostream& operator << (ostream& o, pair<A, B> a) {
return o << '(' << a.X << ", " << a.Y << ')';
}
template <typename T> ostream& operator << (ostream& o, vector<T> a) {
bool is = false;
for (T i : a) {o << (is ? ' ' : '{'), is = true, o << i;}
return o << '}';
}
template <typename T> struct vv : vector <vector <T>> {
vv(int n, int m, T v) : vector <vector <T>> (n, vector <T>(m, v)) {}
};
template <typename T> struct vvv : vector <vv <T>> {
vvv(int n, int m, int k, T v) : vector <vv <T>> (n, vv <T>(m, k, v)) {}
};
#ifdef Doludu
#define test(args...) info(), abc("[" + string(#args) + "]", args)
#define owo
#include "koala-grader.cpp"
#else
#define test(args...)
#define owo ios::sync_with_stdio(false); cin.tie(0)
#endif
// const int mod = 998244353, N = 1000001, logN = 20, K = 111;
void playRound(int *b, int *r);
int minValue(int n, int w) {
int cur[n]{}, res[n];
cur[0] = 1;
playRound(cur, res);
if (res[0] < 2) return 0;
for (int i = 1; i < n; ++i) if (res[i] == 0) return i;
}
int maxValue(int n, int w) {
int cur[n]{}, res[n]{};
vector <bool> possible(n, true);
for (int i = 0; i < n; ++i) if (res[i] > 1) possible[i] = true;
while (true) {
int cnt = count(all(possible), true);
if (cnt == 1) break;
int re = n / cnt;
for (int i = 0; i < n; ++i) {
if (possible[i]) cur[i] = re;
else cur[i] = 0;
}
playRound(cur, res);
for (int i = 0; i < n; ++i) if (possible[i] && res[i] <= cur[i]) possible[i] = false;
}
return find(all(possible), true) - possible.begin();
}
int greaterValue(int n, int w) {
int cur[n]{}, res[n];
cur[0] = cur[1] = 1;
playRound(cur, res);
if (res[0] > 1) return 0;
if (res[1] > 1) return 1;
int x = 6;
cur[0] = cur[1] = x;
playRound(cur, res);
if (res[0] > x) return 0;
if (res[1] > x) return 1;
assert(false);
}
void allValues(int n, int w, int *p) {
if (w == n * 2) {
for (int i = 0; i < n; ++i) {
}
} else {
}
}
/*
2 1
6 6 5 3 2 1 6 4
*/
Compilation message
koala.cpp: In function 'int minValue(int, int)':
koala.cpp:55:1: warning: control reaches end of non-void function [-Wreturn-type]
55 | }
| ^
# |
결과 |
실행 시간 |
메모리 |
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 |
Correct |
18 ms |
200 KB |
Output is correct |
2 |
Correct |
16 ms |
308 KB |
Output is correct |
3 |
Correct |
20 ms |
312 KB |
Output is correct |
4 |
Correct |
14 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 |
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 |
- |