제출 #605253

#제출 시각아이디문제언어결과실행 시간메모리
605253TigryonochekkCounting Mushrooms (IOI20_mushrooms)C++17
0 / 100
1 ms208 KiB
#include <iostream> #include "mushrooms.h" #include <vector> #define ll long long using namespace std; int n; vector<int> a = { 0 }, b; int ans = 1; void execA(int s, int t) { if (s == t) return; int c = a.size(); vector<int> m; int j = 0; for (int i = s; i < t; i++) { m.push_back(a[j]); m.push_back(i); j++; } int k = use_machine(m); if (k % 2 == 0) { b.push_back(m.back()); } else { a.push_back(m.back()); } ans += t - s - k / 2; } void execB(int s, int t) { if (s == t) return; int c = b.size(); vector<int> m; int j = 0; for (int i = s; i < t; i++) { m.push_back(b[j]); m.push_back(i); j++; } int k = use_machine(m); if (k % 2 == 1) { b.push_back(m.back()); } else { a.push_back(m.back()); } ans += k / 2; } int count_mushrooms(int nigga) { n = nigga; if (n <= 450) { for (int i = 1; i < n - 1; i += 2) { ans += 2 - use_machine({ i, 0, i + 1 }); } if (n % 2 == 0) { ans += 1 - use_machine({ n - 1, 0 }); } return ans; } int x = 160; for (int i = 1; i < x; i += 2) { int u = use_machine({ 0, i, 0, i + 1 }); if (u == 0) { a.push_back(i); a.push_back(i + 1); ans += 2; } else if(u == 1){ b.push_back(i); a.push_back(i + 1); ans++; } else if (u == 2) { a.push_back(i); b.push_back(i + 1); ans++; } else { b.push_back(i); b.push_back(i + 1); } } int s = x; while (s < n) { if (a.size() >= b.size()) { int t = min(n, s + (int)a.size()); execA(s, t); s = t; } else { int t = min(n, s + (int)b.size()); execB(s, t); s = t; } } return ans; } /* */

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

mushrooms.cpp: In function 'void execA(int, int)':
mushrooms.cpp:13:6: warning: unused variable 'c' [-Wunused-variable]
   13 |  int c = a.size();
      |      ^
mushrooms.cpp: In function 'void execB(int, int)':
mushrooms.cpp:33:6: warning: unused variable 'c' [-Wunused-variable]
   33 |  int c = b.size();
      |      ^
#Verdict Execution timeMemoryGrader output
Fetching results...