제출 #346092

#제출 시각아이디문제언어결과실행 시간메모리
346092lLab_버섯 세기 (IOI20_mushrooms)C++14
0 / 100
0 ms364 KiB
#include "mushrooms.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> A = {0};

int count_mushrooms(int n) {
    int sum = 1;
    for(int i=1;i<n/10;i++){
        int d = use_machine({0,i});
        if(d == 0){
            A.push_back(i);
            sum++;
        }
    }

    for(int i=(n/10)+1;i<n;i+=A.size()+1){
        vector<int> S;
        for(int j=i;j<i+A.size()+1;++j){
            S.push_back(A[j-i]);
            S.push_back(j);
        }
        int d = use_machine(S);
        sum += A.size()-(d+1)/2;
    }

    return sum;
}

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

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:19:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |         for(int j=i;j<i+A.size()+1;++j){
      |                     ~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...