# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
831582 | ALeonidou | Counting Mushrooms (IOI20_mushrooms) | C++17 | 191 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 <bits/stdc++.h>
using namespace std;
#define ll int
#define F first
#define S second
#define sz(x) (ll)x.size()
#define MID ((l+r)/2)
#define pb push_back
#define dbg(x) cout<<#x<<": "<<x<<endl;
#define dbg2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl;
#define dbg3(x,y,z) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<endl;
#define dbg4(x,y,z,w) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<" "<<#w<<": "<<w<<endl;
#define INF 1e9
typedef vector <ll> vi;
typedef pair<ll,ll> ii;
typedef vector <ii> vii;
void printVct(vi &v, string s =""){
if (sz(s) > 0) cout<<s<<": ";
for (ll i=0; i<sz(v); i++){
cout<<v[i]<<" ";
}
cout<<endl;
}
void tabb(ll n) {
for (ll i= 0; i<n; i++) cout<<"\t";
}
ll askk(ll l, ll r){
vi v;
for (ll i=l ;i<=r; i++) v.pb(i);
//printVct(v,"ask:");
return use_machine(v);
}
int count_mushrooms(int n) {
ll ans = 1;
ll c = 0; //A:1, B:0
for (ll i=0; i<n-1; i++){
ll u = askk(i,i+1);
//dbg(u);
if (c == 0){
if (u == 0){
ans++;
}
else{
c = 1;
}
}
else{
if (u == 1){
ans++;
c = 0;
}
}
// dbg(ans);
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |