제출 #628917

#제출 시각아이디문제언어결과실행 시간메모리
628917flashmt드문 곤충 (IOI22_insects)C++17
0 / 100
12 ms284 KiB
#include <bits/stdc++.h> #include "insects.h" using namespace std; vector<int> findFirstOccurrences(int n, vector<int> &id) { vector<int> res; for (int i = 0; i < n; i++) if (id[i] < 0) { move_inside(i); if (press_button() > 1) move_outside(i); else { id[i] = size(res); res.push_back(i); } } for (int i : res) move_outside(i); return res; } int min_cardinality(int n) { vector<int> id(n, -1); auto occurrences = findFirstOccurrences(n, id); int typeCnt = size(occurrences); int maxC = n / typeCnt; if (maxC <= typeCnt) { int ans = 1; while (1) { auto occ = findFirstOccurrences(n, id); if (size(occ) != typeCnt) return ans; ans++; } } vector<int> cnt(n); for (int i = 0; i < n; i++) if (id[i] < 0) { move_inside(i); for (int j : occurrences) { move_inside(j); if (press_button() == 2) { cnt[j]++; move_outside(j); break; } move_outside(j); } move_outside(i); } int ans = *max_element(begin(cnt), end(cnt)) + 1; return ans; }

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

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:37:21: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   37 |       if (size(occ) != typeCnt)
      |           ~~~~~~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...