제출 #1204216

#제출 시각아이디문제언어결과실행 시간메모리
1204216borisAngelov버섯 세기 (IOI20_mushrooms)C++20
0 / 100
6 ms440 KiB
#include "mushrooms.h" #include <bits/stdc++.h> using namespace std; int count_mushrooms(int n) { int ans = 0, type = 0; for (int i = 0; i < n; ++i) { int l = i + 1; int r = n - 1; while (l <= r) { int mid = (l + r) / 2; vector<int> query; for (int j = i; j <= mid; ++j) { query.push_back(j); } int result = use_machine(query); if (result == 0) { l = mid + 1; } else { r = mid - 1; } } if (type == 0) ans += (r - i + 1); i = r; type = 1 - type; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...