제출 #629054

#제출 시각아이디문제언어결과실행 시간메모리
629054two_sides드문 곤충 (IOI22_insects)C++17
0 / 100
1 ms336 KiB
#include "insects.h" #include <bits/stdc++.h> namespace { using namespace std; mt19937 rng(chrono::high_resolution_clock ::now().time_since_epoch().count()); set<int> inside, useless; vector<int> ord; void insert(int i) { inside.insert(i); move_inside(ord[i]); } void erase(int i) { inside.erase(i); move_outside(ord[i]); } } int min_cardinality(int n) { iota(ord.begin(), ord.end(), 0); shuffle(ord.begin(), ord.end(), rng); for (int i = 0; i < n; i++) { insert(i); if (press_button() > 1) erase(i); } int t = inside.size(); int l = 1, r = n / t; while (l < r) { int m = (l + r + 1) / 2; vector<int> last; for (int i = 0; i < n; i++) if (!inside.count(i) && !useless.count(i)) { insert(i); if (press_button() > m) { erase(i); useless.insert(i); } else { last.push_back(i); if (inside.size() == m * t) break; } } if (inside.size() == m * t) l = m; else { for (int i : inside) useless.erase(i); for (int i : last) erase(i); r = m - 1; } } return r; }

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

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:44:39: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   44 |                     if (inside.size() == m * t) break;
      |                         ~~~~~~~~~~~~~~^~~~~~~~
insects.cpp:47:27: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   47 |         if (inside.size() == m * t) l = m;
      |             ~~~~~~~~~~~~~~^~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...