답안 #1061438

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1061438 2024-08-16T09:04:55 Z TlenekWodoru 드문 곤충 (IOI22_insects) C++17
0 / 100
32 ms 600 KB
#include<bits/stdc++.h>
#include "insects.h"
using namespace std;
bool zaj[2009];
int min_cardinality(int n)
{
    int r=0;
    vector<int>U;
    for(int i=0;i<n;i++)
    {
        move_inside(i);
        int u=press_button();
        if(u>1)
        {
            move_outside(i);
            U.push_back(i);
        }
        else
        {
            zaj[i]=1;
            r++;
        }
    }
    int w=1;
    if((int)U.size()==0){return w;}
    while(true)
    {
        if((int)U.size()<r){return w;}
        int d=(((int)U.size()/r+1)/2);
        vector<int>A,B;
        for(int i=0;i<n;i++)
        {
            if(zaj[i]){continue;}
            move_inside(i);
            int u=press_button();
            if(u>w+d)
            {
                move_outside(i);
                B.push_back(i);
            }
            else
            {
                A.push_back(i);
            }
        }
        if((int)A.size()==d*r)
        {
            w+=d;
            for(int u : A)
            {
                zaj[u]=1;
            }
            U=B;
        }
        else
        {
            for(int u : B)
            {
                zaj[u]=1;
            }
            U=A;
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 4 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 4 ms 444 KB Output is correct
9 Incorrect 2 ms 344 KB Wrong answer.
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 4 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 4 ms 444 KB Output is correct
9 Incorrect 2 ms 344 KB Wrong answer.
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 26 ms 444 KB Output is correct
8 Correct 10 ms 340 KB Output is correct
9 Correct 32 ms 600 KB Output is correct
10 Correct 32 ms 344 KB Output is correct
11 Correct 26 ms 444 KB Output is correct
12 Correct 23 ms 344 KB Output is correct
13 Incorrect 24 ms 592 KB Wrong answer.
14 Halted 0 ms 0 KB -