제출 #436348

#제출 시각아이디문제언어결과실행 시간메모리
436348yuto1115버섯 세기 (IOI20_mushrooms)C++17
25 / 100
160 ms256 KiB
#include "mushrooms.h"
#include "bits/stdc++.h"
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, s, n) for(ll i = ll(s); i < ll(n); i++)
#define rrep(i, n) for(ll i = ll(n)-1; i >= 0; i--)
#define pb push_back
#define eb emplace_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vp = vector<P>;
using vvp = vector<vp>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vs = vector<string>;

template<class T>
bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int count_mushrooms(int n) {
    int ans = 1;
    for (int i = 1; i < n; i += 2) {
        if (i + 1 < n) ans += 2 - use_machine({i, 0, i + 1});
        else ans += 1 - use_machine({0, i});
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...