제출 #429186

#제출 시각아이디문제언어결과실행 시간메모리
429186abdzag버섯 세기 (IOI20_mushrooms)C++17
0 / 100
1 ms200 KiB
#include<bits/stdc++.h> #include<unordered_map> #include<unordered_set> #include "mushrooms.h" #define rep(i,a,b) for(int i=int(a);i<int(b);i++) #define rrep(i,a,b) for(int i=int(a);i>int(b);i--) #define trav(a,v) for(auto& a: v) #define sz(v) v.size() #define all(v) v.begin(),v.end() #define vi vector<int> typedef long long ll; typedef long double ld; typedef unsigned long long ull; const long long inf = 2e9; using namespace std; int count_mushrooms(int n) { ll ans = 0; vector<int> v(3); queue<ll> q; rep(i, 1, n)q.push(i); while (!q.empty()) { v[0] = q.front(); q.pop(); if (q.empty()) { v.pop_back(); ll cur = use_machine(v); if (cur == 0)ans++; } else { v[2] = q.front(); q.pop(); ll cur = use_machine(v); if (cur == 0) { ans += 2; } else if (cur == 1) { ans += 1; } } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...