# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
775783 | davitmarg | Koala Game (APIO17_koala) | C++17 | 3 ms | 336 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"
/*
-----orz------
DavitMargaryan
-----orz------
*/
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <bitset>
#include <stack>
#include <cassert>
#include <iterator>
#include <random>
#include <chrono>
#define mod 998244353ll
#define LL long long
#define LD long double
#define MP make_pair
#define PB push_back
#define all(v) v.begin(), v.end()
#define fastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
const int N = 500005;
int n, w;
int B[N], R[N];
void query()
{
for (int i = 0; i < n; i++)
R[i] = 0;
playRound(B, R);
}
void query(vector<int> b)
{
for (int i = 0; i < n; i++)
B[i] = b[i];
query();
}
int minValue(int nn, int ww) {
n = nn;
w = ww;
B[0] = 1;
query();
if(R[0] < 2)
return 0;
for(int i = 0; i < n; i++)
if(R[i] == 0)
return i;
}
int maxValue(int nn, int ww) {
n = nn;
w = ww;
int res = 0;
vector<int> p;
for(int i = 0; i < n; i++)
p.push_back(i);
int k = 1;
while(p.size() > 1)
{
for(int i = 0; i < n; i++)
B[i] = 0;
for(int i = 0; i < p.size(); i++)
B[p[i]] = k;
query();
vector<int> np;
for(int i = 0; i < p.size(); i++)
if(R[p[i]] > B[p[i]])
np.push_back(p[i]);
p = np;
k+=2;
}
return p[0];
}
int greaterValue(int nn, int ww) {
return 0;
}
void allValues(int nn, int ww, int *P) {
if (ww == 2*nn) {
// 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.
}
}
/*
2 1
5 5
3 5 4 1 2
2 1
6 6
5 3 2 1 4 6
*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |