제출 #726330

#제출 시각아이디문제언어결과실행 시간메모리
726330ismayil드문 곤충 (IOI22_insects)C++17
47.50 / 100
251 ms432 KiB
#pragma GCC optimize("O3") #include "insects.h" #include <bits/stdc++.h> using namespace std; //g++ -std=c++17 insects.cpp stub.cpp int D, N; bool check(int m){ vector<int> in; for(int j = 0; j < N; j++){ move_inside(j); if(press_button() > m){ move_outside(j); }else{ in.push_back(j); } } bool flag = false; if(in.size() < m * D){ flag = true; } while(!in.empty()) move_outside(in.back()), in.pop_back(); return flag; } int min_cardinality(int n) { N = n; vector<int> in; for(int j = 0; j < N; j++){ move_inside(j); if(press_button() > 1){ move_outside(j); }else{ in.push_back(j); } } D = in.size(); while(!in.empty()) move_outside(in.back()), in.pop_back(); int l = 1, r = N; while(l <= r){ int m = (l + r) / 2; if(check(m)) r = m - 1; else l = m + 1; } return r; }

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

insects.cpp: In function 'bool check(int)':
insects.cpp:18:15: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   18 |  if(in.size() < m * D){
      |     ~~~~~~~~~~^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...