제출 #633915

#제출 시각아이디문제언어결과실행 시간메모리
633915Kirill22드문 곤충 (IOI22_insects)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; void move_inside(int i); void move_outside(int i); int press_button(); int min_cardinality(int n) { mt19937 gen(22); vector<int> ord(n); iota(ord.begin(), ord.end(), 0); shuffle(ord.begin(), ord.end(), gen); vector<int> used(n); for (auto i : ord) { move_inside(i); if (press_button() >= 2) { move_outside(i); } else { used[i] = 1; } } int cnt = accumulate(used.begin(), used.end(), 0); if (cnt == 1) { return n; } int l = 1, r = n / cnt + 1; auto start = used; vector<int> ban(n); while (l + 1 < r) { int m = (l + r) / 2; for (auto i : ord) { { if (used[i] && !start[i]) { used[i] = 0; move_outside(i); } } vector<int> b; int cnt2 = accumulate(used.begin(), used.end(), 0); for (auto i : ord) { { if (!used[i] && !ban[i]) { move_inside(i); int res = press_button(); if (res >= m + 1) { move_outside(i); b.push_back(i); } else { used[i] = 1; cnt2++; if (cnt2 == m * cnt) { break; } } } } //cout << m << " " << cnt2 << endl; //for (auto x : used) cout << x << " "; cout << endl; //for (auto x : ban) cout << x << " "; cout << endl; if (m * cnt == cnt2) { l = m; start = used; } else { r = m; for (auto i : b) { ban[i] = 1; } } } return l; }

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

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:70:1: error: expected '}' at end of input
   70 | }
      | ^
insects.cpp:30:23: note: to match this '{'
   30 |     while (l + 1 < r) {
      |                       ^
insects.cpp:70:1: error: expected '}' at end of input
   70 | }
      | ^
insects.cpp:9:28: note: to match this '{'
    9 | int min_cardinality(int n) {
      |                            ^
insects.cpp:11:22: warning: control reaches end of non-void function [-Wreturn-type]
   11 |     vector<int> ord(n);
      |                      ^