제출 #604560

#제출 시각아이디문제언어결과실행 시간메모리
604560Sam_a17버섯 세기 (IOI20_mushrooms)C++14
25 / 100
134 ms248 KiB
#include <bits/stdc++.h> using namespace std; #define sz(x) (int((x).size())) #define len(x) (int)x.length() #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define dbg(x) cout << #x << " " << x << endl; #define uniq(x) x.resize(unique(all(x)) - x.begin()); #define pb push_back #define ld long double #define ll long long // #include "mushrooms.h" int use_machine(vector<int> m); int count_mushrooms(int n) { // std::vector<int> m; // for (int i = 0; i < n; i++) // m.push_back(i); // int c1 = use_machine(m); // m = {0, 1}; // int c2 = use_machine(m); // return c1+c2; int curr = 1; vector<int> a{0}, b; int s = 1; for(int i = 1; i + 1 < n; i += 2) { vector<int> ask{i, 0, i + 1}; int c1 = use_machine(ask); s += 2 - c1; } if(n % 2 == 0) { vector<int> ask{0, n - 1}; int c1 = use_machine(ask); s += 1 - c1; } return s; }

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

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:27:7: warning: unused variable 'curr' [-Wunused-variable]
   27 |   int curr = 1;
      |       ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...