Submission #831582

#TimeUsernameProblemLanguageResultExecution timeMemory
831582ALeonidouCounting Mushrooms (IOI20_mushrooms)C++17
10 / 100
191 ms208 KiB
#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 timeMemoryGrader output
Fetching results...