제출 #628367

#제출 시각아이디문제언어결과실행 시간메모리
628367Sasha008드문 곤충 (IOI22_insects)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
//#include "insects.h"
//#pragma GCC optimize ("O3")
using namespace std;
#define el "\n"
#define se " "
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
const ll INF=1e18,ch=1e18;
ll a,b,c,d,n,COST,t,last,ab,ba,n1,n2,fl1,fl2,o1,o2,flag,flag1,flag2,g,m,m1,m2,i,j,lr,f,k,l,r,y,o,p,mx=-ch,mx1=-ch,mx2=-ch,q,q1,q2,q3,q4,mn=ch,mn1=ch,mn2=ch,f1,f2,f3,pos,ans,sum,sz=1,MOD=1e9+7,zero=0,a1,b1,c1,val,sum1,cur,res,ans1,res1,kk,kkk,cnt,cnt1,fl;
ll S[2005];
ll A[2005];
//void move_inside(int i)
//void move_outside(int i)
//int press_button()
bool pr(ll m)
{
    ans=0;
    for(i=0;i<n;i++)
    {
        if (S[i]==1) continue;
        move_inside(i);
        A[i]=1;
        if (press_button()+q>m)
        {
            A[i]=0;
            move_outside(i);
        }
        else
        {
            ans++;
        }
    }
    if ((m-q)*d==ans) return 1;
    return 0;
}
int min_cardinality(int N)
{
    n=N;
    d=0;
    for(i=0;i<n;i++)
    {
        move_inside(i);
        d++;S[i]=1;

        if (press_button()>1)
        {
            move_outside(i);
            d--;S[i]=0;
        }
    }
    for(i=0;i<n;i++)
    {
        if (S[i]==1) move_outside(i);
    }
    o=1;l=2;r=n/d;q=1;
    while(l+1<r)
    {
        for(i=0;i<n;i++)
        {
            A[i]=0;
        }
        m=(l+r)/2;
        if (pr(m)==1)
        {
            o=m;
            l=m+1;
            q=m;
            for(i=0;i<n;i++)
            {
                if (A[i]==1)
                {
                    S[i]=1;
                    move_outside(i);
                }
            }
        }
        else
        {
            r=m-1;
            for(i=0;i<n;i++)
            {
                if (A[i]==1)
                {
                    move_outside(i);
                }
            }
        }
    }
    return o;
}
//int main()
//{
//    ios_base::sync_with_stdio(0);
//    cin.tie(0);
//    cout.tie(0);
//    cin>>n>>a>>b;
//    vector < vector < int > > v=devise_strategy(a,b);
//}

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

insects.cpp: In function 'bool pr(long long int)':
insects.cpp:25:9: error: 'move_inside' was not declared in this scope
   25 |         move_inside(i);
      |         ^~~~~~~~~~~
insects.cpp:27:13: error: 'press_button' was not declared in this scope
   27 |         if (press_button()+q>m)
      |             ^~~~~~~~~~~~
insects.cpp:30:13: error: 'move_outside' was not declared in this scope
   30 |             move_outside(i);
      |             ^~~~~~~~~~~~
insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:46:9: error: 'move_inside' was not declared in this scope
   46 |         move_inside(i);
      |         ^~~~~~~~~~~
insects.cpp:49:13: error: 'press_button' was not declared in this scope
   49 |         if (press_button()>1)
      |             ^~~~~~~~~~~~
insects.cpp:51:13: error: 'move_outside' was not declared in this scope
   51 |             move_outside(i);
      |             ^~~~~~~~~~~~
insects.cpp:57:22: error: 'move_outside' was not declared in this scope
   57 |         if (S[i]==1) move_outside(i);
      |                      ^~~~~~~~~~~~
insects.cpp:77:21: error: 'move_outside' was not declared in this scope
   77 |                     move_outside(i);
      |                     ^~~~~~~~~~~~
insects.cpp:88:21: error: 'move_outside' was not declared in this scope
   88 |                     move_outside(i);
      |                     ^~~~~~~~~~~~