제출 #1355998

#제출 시각아이디문제언어결과실행 시간메모리
1355998vjudge1드문 곤충 (IOI22_insects)C++20
컴파일 에러
0 ms0 KiB
#include "insects.h"
#include<bits/stdc++.h>
using namespace std;
int min_cardinality(int N) {
    for(int i=0;i<N;i++){
        move_inside(i);
        for(int j=i+1;j<N;j++){
            move_inside(j);
            if(j>=i+2)move_outside(j-1);
            int val=press_button();
            if(val==2)join(i,j);
        }
        move_outside(i);
        move_outside(N-1);
    }
    int l=1,r=N;
    while(l<r){
        int ch=0;
        int mid=(l+r)/2;
        for(int i=0;i<n;i++){
            move_inside(i);
            ch=1;
            for(int j=i+1;j<N;j++){
                move_inside(j);
                if(j>=i+2)move_outside(j-1);
                int val=press_button();
                if(val>mid){
                    move_outside(j);
                    ch=0;
                    break;
                }
            }
            move_outside(i);
            if(ch)break;
           // move_outside(N-1);
        }
        if(ch)r=mid;
        else l=mid+1;
    }
    return l;
}

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

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:11:23: error: 'join' was not declared in this scope; did you mean 'std::ranges::views::join'?
   11 |             if(val==2)join(i,j);
      |                       ^~~~
      |                       std::ranges::views::join
In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:89,
                 from insects.cpp:2:
/usr/include/c++/13/ranges:3074:28: note: 'std::ranges::views::join' declared here
 3074 |     inline constexpr _Join join;
      |                            ^~~~
insects.cpp:20:23: error: 'n' was not declared in this scope
   20 |         for(int i=0;i<n;i++){
      |                       ^