제출 #1034355

#제출 시각아이디문제언어결과실행 시간메모리
1034355Mr_Husanboy드문 곤충 (IOI22_insects)C++17
0 / 100
1 ms344 KiB
#include "insects.h" #include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define all(a) (a).begin(), (a).end() #define ll long long const int mod = 1000002022; vector<int> state, p; int n, m; vector<vector<int>> g; template<typename T> int len(T &a){return a.size();} int min_cardinality(int n) { vector<vector<int>> ar; for(int i = 0; i < n; i ++){ move_inside(i); int now = press_button(); if(now > len(ar)){ ar.push_back(vector<int>()); ar.back().push_back(i); continue; } int l = -1, r = len(ar) - 1; int j = r; while(r - l > 1){ int m = (l + r) / 2; while(j > m){ for(auto u : ar[j]){ move_outside(u); } j --; } while(j < m){ j ++; for(auto u : ar[j]){ move_inside(u); } } if(press_button() == j + 1){ r = m; }else l = m; } while(j + 1 < len(ar)){ j ++; for(auto u : ar[j]) move_inside(u); } ar[r].push_back(i); } int ans = n; for(int i = 0; i < len(ar); i ++) ans = min(ans, len(ar[i])); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...