제출 #787746

#제출 시각아이디문제언어결과실행 시간메모리
787746Andrey드문 곤충 (IOI22_insects)C++17
0 / 100
0 ms208 KiB
#include "insects.h" #include<bits/stdc++.h> using namespace std; int n,p = 0; vector<bool> idk(10000,true); bool check(int a) { vector<bool> bruh(n,true); vector<int> wut(0); vector<int> yay(0); int br = n; for(int i = 0; i < n; i++) { if(idk[i]) { move_inside(i); if(press_button() > a) { bruh[i] = false; yay.push_back(i); move_outside(i); br--; } else { wut.push_back(i); } } } if(br == p*a) { for(int i = 0; i < wut.size(); i++) { idk[wut[i]] = false; } return false; } else { for(int i = 0; i < n; i++) { if(bruh[i] && idk[i]) { move_outside(i); } } for(int i = 0; i < yay.size(); i++) { bruh[yay[i]] = false; } return true; } } int min_cardinality(int N) { n = N; int l = 1,m,r; vector<bool> bruh(n,true); for(int i = 0; i < n; i++) { move_inside(i); if(press_button() > 1) { move_outside(i); bruh[i] = false; } else { p++; } } r = n/p; if(p == 1) { return n; } for(int i = 0; i < n; i++) { if(bruh[i]) { move_outside(i); } } while(l < r) { m = (l+r+1)/2; if(check(m)) { r = m-1; } else { l = m; } for(int i = 0; i < n; i++) { cout << idk[i] << " "; } cout << endl; } return l; }

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

insects.cpp: In function 'bool check(int)':
insects.cpp:28:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |         for(int i = 0; i < wut.size(); i++) {
      |                        ~~^~~~~~~~~~~~
insects.cpp:39:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |         for(int i = 0; i < yay.size(); i++) {
      |                        ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...