제출 #815183

#제출 시각아이디문제언어결과실행 시간메모리
815183biank드문 곤충 (IOI22_insects)C++17
0 / 100
279 ms208 KiB
#include <bits/stdc++.h> using namespace std; void move_inside(int i); void move_outside(int i); int press_button(); int min_cardinality(int N) { vector <int> done(N, 0); stack <int> in; move_inside(0); done[0] = true; int T = 0; for (int i=1; i<N; i++) { move_inside(i); if (press_button() == 1) { done[i] = true; in.push(i); T++; } else { move_outside(i); } } int ans = 1; while (true) { int K = 0; while (!in.empty()) { move_outside(in.top()); in.pop(); } for (int i=0; i<N; i++) { if (done[i]) { continue; } move_inside(i); if (press_button() == 1) { done[i] = true; in.push(i); K++; } else { move_outside(i); } if (K == T) { break; } } if (K < T) { break; } ans++; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...