Submission #1234056

#TimeUsernameProblemLanguageResultExecution timeMemory
1234056madamadam3버섯 세기 (IOI20_mushrooms)C++20
0 / 100
1 ms420 KiB
#include "mushrooms.h" #include <bits/stdc++.h> using namespace std; #ifdef LOCAL #define dbg(x) (cout << (x)) #else #define dbg(x) #endif using vi =vector<int>; #define pb push_back #define FOR(i, a, b) for (int i = a; i < b; i++) int count_mushrooms(int n) { vi isa(n, 0); isa[0] = 1; int top_it = min(n, 200); for (int i = 1; i < top_it; i++) { isa[i] = 1 - use_machine(vi({0, i})); } if (top_it == n) return accumulate(isa.begin(), isa.end(), 0); vi filter_base(199, 0); int cur_pos = 0; for (int i = 0; i < 200 && cur_pos < 200; i++) { if (!isa[i]) continue; filter_base[cur_pos] = i; cur_pos += 2; } int tl_a = accumulate(isa.begin(), isa.end(), 0); for (int i = 200; i < n; i += 99) { int spots = min(99, n - i); vi filter(filter_base.begin(), filter_base.end()); int ps = 1; for (int j = i; j < i + spots; j++) { filter[ps] = j; ps += 2; } int tl_non = use_machine(filter) / 2; tl_a += spots - tl_non; } return tl_a; }
#Verdict Execution timeMemoryGrader output
Fetching results...