# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1052070 | 2024-08-10T11:39:38 Z | TahirAliyev | 버섯 세기 (IOI20_mushrooms) | C++17 | 1 ms | 432 KB |
#include "mushrooms.h" #include <bits/stdc++.h> using namespace std; #define pii pair<int, int> #define ll long long #define all(v) v.begin(), v.end() #define oo 1e9 const int B = 141; int count_mushrooms(int n){ vector<int> v[2]; v[0] = {0}; int i = 1; for(; i < min(3, n); i++){ v[use_machine({0, i})].push_back(i); } int t = (v[0].size() < v[1].size()); for(; i + 1 < n && (int)max(v[0].size(), v[1].size()) < B; i += 2){ int a = use_machine({i, v[t][0], i + 1, v[t][1]}); v[t ^ (a & 1)].push_back(i); v[t ^ (a & 2)].push_back(i + 1); } if(i == n - 1){ v[use_machine({0, i})].push_back(i); i++; } int ans = v[0].size(); if(i == n) return ans; t = (v[0].size() < v[1].size()); while(i < n){ vector<int> tmp; for(int j = 0; j < v[t].size() && i < n; j++, i++){ tmp.push_back(v[t][j]); tmp.push_back(i); } if(t) ans += (use_machine(tmp) + 1) / 2; else ans += (tmp.size() / 2) - (use_machine(tmp) + 1) / 2; } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Incorrect | 0 ms | 432 KB | Answer is not correct. |
4 | Halted | 0 ms | 0 KB | - |