제출 #310091

#제출 시각아이디문제언어결과실행 시간메모리
310091Tc14버섯 세기 (IOI20_mushrooms)C++17
56.78 / 100
11 ms384 KiB
//#pragma GCC optimize("O3") #include <bits/stdc++.h> #include "mushrooms.h" using namespace std; #define ve vector typedef long long ll; typedef pair<int, int> pii; const int INF = 1e9 + 10; int count_mushrooms(int n) { int ans, k, l, r, a; bool z; ve<int> M, A, B, C; l = 100; ans = 1; A.push_back(0); k = 2 * l + 1; for (int i = 1; i < k; i++) { if (i >= n) return ans; M = {0, i}; if (use_machine(M) == 0) { A.push_back(i); ans++; } else B.push_back(i); } if (A.size() >= l + 1) { z = false; C = A; } else { z = true; C = B; } while (k < n) { M = {}; a = 0; for (int i = 0; i < l; i++) { if (k >= n) break; M.push_back(C[i]); M.push_back(k); k++; a++; } M.push_back(C[a]); r = use_machine(M); if (z) ans += r / 2; else ans += a - (r / 2); } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:33:18: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   33 |     if (A.size() >= l + 1) {
      |         ~~~~~~~~~^~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...