답안 #1080195

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1080195 2024-08-29T07:55:38 Z Muhammad_Aneeq 버섯 세기 (IOI20_mushrooms) C++17
0 / 100
1 ms 432 KB
#include <vector>
#include <iostream>
using namespace std;
int use_machine(vector<int> x);
int count_mushrooms(int n)
{
    vector<int>sz[2]={};
    sz[0].push_back(0);
    int mx=94;
    for (int i=1;i<n;i++)
    {       
            sz[use_machine({0,i})].push_back(i);
            if (sz[0].size()>=mx||sz[1].size()>=mx)
                break;
    }
    if (sz[1]>sz[0])
        swap(sz[0],sz[1]);
    int cnt[2]={};
    cnt[0]=sz[0].size();
    for (int i=sz[0].size()+sz[1].size();i<n;i+=mx)
    {
        vector<int>qu;
        int f=min(i+mx,n)-i;
        for (int j=i;j<min(i+mx,n);j++)
        {
            qu.push_back(j);
            qu.push_back(sz[0][j-i]);
        }
        int x=use_machine(qu);
        cnt[0]+=f-(x+1)/2;
    }
    cnt[1]=n-cnt[0];
    if (sz[0][0]==0)
        return cnt[0];
    return cnt[1];
}

Compilation message

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:13:29: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   13 |             if (sz[0].size()>=mx||sz[1].size()>=mx)
      |                 ~~~~~~~~~~~~^~~~
mushrooms.cpp:13:47: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   13 |             if (sz[0].size()>=mx||sz[1].size()>=mx)
      |                                   ~~~~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 432 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Incorrect 1 ms 344 KB Duplicate value 0 in the query array.
7 Halted 0 ms 0 KB -