# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
305211 | ScarletS | Counting Mushrooms (IOI20_mushrooms) | C++17 | 125 ms | 384 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>
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |