제출 #628797

#제출 시각아이디문제언어결과실행 시간메모리
628797abeker드문 곤충 (IOI22_insects)C++17
0 / 100
3 ms304 KiB
#include <bits/stdc++.h> #include "insects.h" using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int min_cardinality(int N) { vector <int> rest; auto attempt = [&](int x, int v) { move_inside(x); if (press_button() != v) { rest.push_back(x); move_outside(x); } }; for (int i = 0; i < N; i++) attempt(i, 1); int sol = 1, cnt = N - (int)rest.size(); for (; !rest.empty(); sol++) { vector <int> tmp = rest; rest.clear(); shuffle(tmp.begin(), tmp.end(), rng); for (int i = 0; i < min(tmp.size(), rest.size() + (size_t)cnt); i++) attempt(tmp[i], sol + 1); if (tmp.size() < rest.size() + cnt) break; } return sol; }

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

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:23:23: warning: comparison of integer expressions of different signedness: 'int' and 'const long unsigned int' [-Wsign-compare]
   23 |     for (int i = 0; i < min(tmp.size(), rest.size() + (size_t)cnt); i++)
      |                     ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...