# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1018883 | 2024-07-10T10:37:41 Z | NintsiChkhaidze | 버섯 세기 (IOI20_mushrooms) | C++17 | 1 ms | 388 KB |
#include "mushrooms.h" #include <bits/stdc++.h> #define pb push_back using namespace std; vector <int> v[3]; int count_mushrooms(int n) { v[0].pb(0); int bl = 2*sqrt(n); for (int i = 1; i <= min(bl,n - 1); i++){ vector <int> k; k.pb(0); k.pb(i); int res = use_machine(k); if (!res) v[0].pb(i); else v[1].pb(i); } int ans = (int)v[0].size(); int id = bl + 1; while (id < n){ int m = max(v[0].size(),v[1].size()),d; vector <int> vec; if (m == v[0].size()){ vec = v[0]; d = 0; }else{ vec = v[1]; d = 1; } vector <int> k; for (int i = id; i <= id + m - 1; i++){ k.pb(i); k.pb(vec[i - id]); } int s = use_machine(k); int ls = s % 2; s -= ls; int sum = s/2 + ls; if (!d) ans += sum; else ans += (m - sum); } 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 | 388 KB | Invalid value 10 in the query array. |
4 | Halted | 0 ms | 0 KB | - |