제출 #629049

#제출 시각아이디문제언어결과실행 시간메모리
629049two_sides드문 곤충 (IOI22_insects)C++17
53.16 / 100
178 ms444 KiB
#include "insects.h" #include <bits/stdc++.h> namespace { using namespace std; set<int> inside; void insert(int i) { inside.insert(i); move_inside(i); } void erase(int i) { inside.erase(i); move_outside(i); } } int min_cardinality(int n) { 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)) { insert(i); if (press_button() > m) erase(i); else { last.push_back(i); if (inside.size() == m * t) break; } } if (inside.size() == m * t) l = m; else { for (int i : last) erase(i); r = m - 1; } } return r; }

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

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:37:39: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   37 |                     if (inside.size() == m * t) break;
      |                         ~~~~~~~~~~~~~~^~~~~~~~
insects.cpp:40:27: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   40 |         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...