제출 #627818

#제출 시각아이디문제언어결과실행 시간메모리
627818tutis드문 곤충 (IOI22_insects)C++17
0 / 100
149 ms1336 KiB
#include "insects.h" #include <bits/stdc++.h> using namespace std; pair<int, int> min_cardinality(vector<int> x) { if (x.size() == 1) return {1, 1}; if (x.empty()) return {0, 0}; vector<int>v; for (int i : x) { v.push_back(i); move_inside(i); int k = press_button(); if (k == 2) { v.pop_back(); move_outside(i); } } for (int i : v) move_outside(i); int cnt = v.size(); if (cnt * 2 > x.size()) return {1, cnt}; if (cnt == (int)x.size()) return {cnt, cnt}; if (cnt == 2) return {min(cnt, (int)x.size() - cnt), 2}; set<int>S(x.begin(), x.end()); for (int i : v) S.erase(i); pair<int, int>ans = min_cardinality(vector<int>(S.begin(), S.end())); if (ans.second != (int)v.size()) return {1, (int)v.size()}; ans.first += 1; return ans; } int min_cardinality(int N) { vector<int>v; for (int i = 0; i < N; i++) v.push_back(i); return min_cardinality(v).first; }

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

insects.cpp: In function 'std::pair<int, int> min_cardinality(std::vector<int>)':
insects.cpp:25:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     if (cnt * 2 > x.size())
      |         ~~~~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...