# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
305854 | myungwoo | Counting Mushrooms (IOI20_mushrooms) | C++17 | 11 ms | 512 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 <bits/stdc++.h>
#include "mushrooms.h"
using namespace std;
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
int count_mushrooms(int N)
{
const int K = 137;
int add = 0;
vector <int> arr[2];
arr[0] = {0};
for (int i=1;i<N;i++){
if (arr[0].size() >= K){
vector <int> test;
for (int j=0;j<K&&i+j<N;j++){
test.push_back(arr[0][j]);
test.push_back(i+j);
}
int res = use_machine(test);
add += test.size()>>1;
add -= res&1;
add -= res>>1;
i += K-1;
}
else if (arr[1].size() >= K){
vector <int> test;
for (int j=0;j<K&&i+j<N;j++){
test.push_back(arr[1][j]);
test.push_back(i+j);
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |