제출 #797743

#제출 시각아이디문제언어결과실행 시간메모리
797743HaroldVemeno드문 곤충 (IOI22_insects)C++17
0 / 100
1 ms208 KiB
#include "insects.h" #include <bits/stdc++.h> #ifdef GUDEB #define D(x) cerr << #x << ": " << (x) << '\n'; #define ifdeb if(true) #else #define D(x) ; #define ifdeb if(false) #endif #define all(x) begin(x), end(x) using namespace std; using ull = unsigned long long; using ll = long long; // #define int ll; int min_cardinality(int n) { vector<bool> skip(n); vector<bool> box(n); int s = 0; for(int i = 0; i < n; ++i) { box[i] = true; move_inside(i); ++s; int c = press_button(); if(c > 1) { move_outside(i); --s; box[i] = false; } } if(s == n) return 1; for(int i = 0; i < n; ++i) { if(box[i]) { move_outside(i); skip[i] = true; } } int rm = 1; int f = 1; int t = n/s; while(f != t) { int m = (f+t+1)/2; for(int i = 0; i < n; ++i) { if(skip[i]) continue; box[i] = true; move_inside(i); int c = press_button(); if(c > m-rm) { move_outside(i); --s; box[i] = false; } } if(box.size() == s*(m-rm)) { rm = m; f = m; for(int i = 0; i < n; ++i) { if(box[i]) skip[i] = true; } } else { t = m-1; for(int i = 0; i < n; ++i) { if(!box[i]) skip[i] = true; } } for(int i = 0; i < n; ++i) { if(box[i]) move_outside(i); box[i] = false; } } return f; }

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

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