답안 #859377

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
859377 2023-10-10T05:50:29 Z thinknoexit 드문 곤충 (IOI22_insects) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "insects.h"
using namespace std;
using ll = long long;
int in[2020];
set<int> candidate;
int min_cardinality(int n) {
    int type = 0;
    for (int i = 0;i < n;i++) {
        move_inside(i);
        if (press_button() == 2) {
            move_outside(i);
            candidate.insert(i)
        }
        else in[i] = 1, type++;
    }
    if (type == 1) return n;
    int mxans = n / type;
    int l = 1, r = mxans;
    int sz = type;
    while (l < r) {
        int mid = (l + r + 1) / 2;
        stack<int> s;
        for (auto i : candidate) {
            move_inside(i);
            if (press_button() > mid) move_outside(i);
            else in[i] = 1, s.push(i), sz++;
        }
        if (sz < type * mid) {
            if (r == l + 1) return l;
            while (!s.empty()) {
                in[s.top()] = 0;
                move_outside(s.top());
                sz--;
                s.pop();
            }
            r = mid - 1;
        }
        else {
            while (!s.empty()) candidate.erase(s.top()), s.pop();
            l = mid;
        }
    }
    return l;
}

Compilation message

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:13:32: error: expected ';' before '}' token
   13 |             candidate.insert(i)
      |                                ^
      |                                ;
   14 |         }
      |         ~