제출 #1266299

#제출 시각아이디문제언어결과실행 시간메모리
1266299meomeo드문 곤충 (IOI22_insects)C++20
0 / 100
0 ms408 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define fi first #define se second #define eb emplace_back #define pb push_back #define vi vector<int> #define vvi vector<vi> #define endl "\n" void move_inside (int i); void move_outside (int i); int press_button (void); int min_cardinality (int N) { int cur_max = 0; vvi groups; for (int i = 0; i < N; i++) { move_inside(i); int get = press_button(); if (get > cur_max) { cur_max = get; groups.pb({i}); } else { move_outside(i); bool ok = false; for (auto& gr : groups) { int before = press_button(); move_inside(i); int after = press_button(); move_outside(i); if (after > before) { gr.pb(i); move_inside(i); ok = true; break; } } if (!ok) { move_inside(i); groups.pb({i}); cur_max = press_button(); } else { move_inside(i); } } } int ans = INT_MAX; for (auto gr : groups) { ans = min(ans, (int)gr.size()); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...