답안 #347306

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
347306 2021-01-12T13:57:53 Z Pherokung 버섯 세기 (IOI20_mushrooms) C++14
0 / 100
31 ms 648 KB
#include "mushrooms.h"
#include<bits/stdc++.h>
using namespace std;
int all,be,mid,ed,arr[20005],type,ans=1;
vector<int> v;
void mush(int be,int ed,int val){
    if(val == 0 || be == ed) return;
    if(val == ed-be){
        for(int i=be+1;i<=ed;i++) arr[i] = 1;
        return;
    }
    int mid = (be+ed)/2,f,s;
    v.clear();
    v.push_back(mid);
    v.push_back(mid+1);
    if(use_machine(v)){
        val--;
        arr[mid+1] = 1;
    }
    v.clear();
    for(int i=be;i<=mid;i++) v.push_back(i);
    f = use_machine(v);
    mush(be,mid,f);
    s = val-f;
    mush(mid+1,ed,s);
    return;
}
int count_mushrooms(int n) {
    for (int i = 0; i < n; i++) v.push_back(i);
    all = use_machine(v);
    mush(0,n-1,all);
    type = 0;
    for(int i=1;i<n;i++){
        type += arr[i];
        if(type % 2 == 0) ans++;
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 2 ms 364 KB Output is correct
6 Partially correct 18 ms 364 KB Output is partially correct
7 Partially correct 13 ms 620 KB Output is partially correct
8 Incorrect 31 ms 648 KB Too many total array sizes as queries.
9 Halted 0 ms 0 KB -