Submission #1057348

#TimeUsernameProblemLanguageResultExecution timeMemory
1057348c2zi6Counting Mushrooms (IOI20_mushrooms)C++14
25 / 100
64 ms344 KiB
#define _USE_MATH_DEFINES #include <bits/stdc++.h> #define ff first #define ss second #define pb push_back #define all(a) (a).begin(), (a).end() #define replr(i, a, b) for (int i = int(a); i <= int(b); ++i) #define reprl(i, a, b) for (int i = int(a); i >= int(b); --i) #define rep(i, n) for (int i = 0; i < int(n); ++i) #define mkp(a, b) make_pair(a, b) using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> PII; typedef vector<int> VI; typedef vector<PII> VPI; typedef vector<VI> VVI; typedef vector<VVI> VVVI; typedef vector<VPI> VVPI; typedef pair<ll, ll> PLL; typedef vector<ll> VL; typedef vector<PLL> VPL; typedef vector<VL> VVL; typedef vector<VVL> VVVL; typedef vector<VPL> VVPL; template<class T> T setmax(T& a, T b) {if (a < b) return a = b; return a;} template<class T> T setmin(T& a, T b) {if (a < b) return a; return a = b;} #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; template<class T> using indset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #include "mushrooms.h" int use_machine(int l, int r) { VI a; replr(i, l, r) a.pb(i); return use_machine(a); } int count_mushrooms(int n) { int ans = 1; for (int i = 1; i < n; i += 2) { if (i+1 < n) { ans += 2-use_machine({i, 0, i+1}); } else { ans += 1-use_machine({0, i}); } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...