# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
604443 | gagik_2007 | Counting Mushrooms (IOI20_mushrooms) | C++17 | 1 ms | 208 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 "mushrooms.h"
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <ctime>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <limits>
#include <iomanip>
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef ll itn;
#define ff first
#define ss second
ll n;
int count_mushrooms(int N) {
n = N;
pair<int, int>sm;
vector<int>ask = { 0,1 };
int vl = use_machine(ask);
int anh = -1;
bool sma = true;
ll ans = 0;
if (vl == 0) {
if (n == 2)return 2;
sm = { 0,1 };
anh = 2;
ans = 2;
}
else {
if (n == 2)return 1;
ask = { 1,2 };
vl = use_machine(ask);
anh = 3;
if (vl == 1) {
if (n == 3)return 2;
sm = { 0,2 };
ans = 2;
}
else {
if (n == 3)return 1;
sm = { 1,2 };
ans = 1;
sma = false;
}
}
for (int i = anh; i < n; i += 2) {
if (i == n - 1) {
ask = { 0,i };
vl = use_machine(ask);
if (vl) {
ans++;
}
break;
}
ask = { sm.ff,i,sm.ss,i + 1 };
vl = use_machine(ask);
if (sma) {
switch (vl)
{
case 0:
break;
case 1:
ans += 1;
break;
case 2:
ans += 1;
break;
case 3:
ans += 2;
break;
}
}
else {
switch (vl)
{
case 0:
ans += 2;
break;
case 1:
ans += 1;
break;
case 2:
ans += 1;
break;
case 3:
break;
}
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |