# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
944090 | Boycl07 | 코알라 (APIO17_koala) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "koala.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 1; (i) <= (n); ++i)
#define forn(i, l, r) for(int i = (l); i <= (r); ++i)
#define ford(i, r, l) for(int i = (r); i >= (l); --i)
#define FOR(i, n) for(int i = 0; i < (n); ++i)
#define FORD(i, n) for(int i = ((n) - 1); i >= 0; --i)
mt19937 rng(192929);
const int MaxN = 2e5 + 3;
int b[MaxN], r[MaxN];
int minValue(int N, int W) {
int x = rng() % N;
b[x] = 1;
playRound(b, r);
int pos_x = 0;
while(r[pos_x]) ++pos_x;
for(int i = 0; i < N; ++i) if(r[i] == 2) return pos_x;
int y = rng() % N ;
b[x] = 0;
b[y] = 1;
playRound(b, r);
int pos_y;
while(r[pos_y]) ++pos_y;
for(int i = 0; i < N; ++i) if(r[i] == 2) return pos_y;
if(pos_x == pos_y) return pos_x;
return (rng() & 1) ? pos_x : pos_y;
}