Submission #395595

#TimeUsernameProblemLanguageResultExecution timeMemory
395595snasibov05Counting Mushrooms (IOI20_mushrooms)C++14
25 / 100
158 ms332 KiB
#include <bits/stdc++.h> #include "mushrooms.h" using namespace std; #define ll long long #define double long double #define ull unsigned long long #define pii pair<int,int> #define tiii tuple<int,int,int> #define pll pair<long long, long long> #define pdd pair<double, double> #define s second #define f first #define pb push_back #define oo 1000000000000000000ll int count_mushrooms(int n) { vector<int> ans(n); ans[0] = 1; for (int i = 1; i < n; i+=2) { vector<int> v; v.push_back(i); v.push_back(0); if(i != n-1) v.push_back(i+1); int x = use_machine(v); if (x == 0 && i != n-1) ans[i] = ans[i+1] = 1; else if ((x == 1 && i!= n-1) || (i == n-1 && x == 0)) ans[i] = 1; } int res = 0; for (int i = 0; i < n; ++i) { if (ans[i] == 1) res++; } return res; } /* void solve() { } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int tst; tst = 1; //cin >> tst; while (tst--){ solve(); } return 0; } */
#Verdict Execution timeMemoryGrader output
Fetching results...