Submission #305211

#TimeUsernameProblemLanguageResultExecution timeMemory
305211ScarletSCounting Mushrooms (IOI20_mushrooms)C++17
25 / 100
125 ms384 KiB
#include "mushrooms.h" #include <bits/stdc++.h> #define sz(x) (int)(x).size() using namespace std; //int N,a[20000],totalQ=0; /** int use_machine(vector<int> v) { int k = sz(v), sendBack=0; for (int i=1;i<k;++i) if (a[v[i]]!=a[v[i-1]]) ++sendBack; return sendBack; }**/ int count_mushrooms(int n) { vector<int> m; int ans=0; for (int i = 1; i+1 < n; i+=2) ans+=use_machine({i,0,i+1}); if (!(n&1)) ans+=use_machine({n-1,0}); return n-ans; } /** int main() { cin>>N; for (int i=0;i<N;++i) cin>>a[i]; cout<<count_mushrooms(N)<<"\n"; cout<<totalQ<<" queries\n"; }**/
#Verdict Execution timeMemoryGrader output
Fetching results...