제출 #1215015

#제출 시각아이디문제언어결과실행 시간메모리
1215015dosts드문 곤충 (IOI22_insects)C++20
0 / 100
2 ms4324 KiB
#include "insects.h" #include <bits/stdc++.h> #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2") //#define int long long #define pii pair<int,int> #define vi vector<int> #define ff first #define ss second #define sp << " " << #define all(x) x.begin(),x.end() #define big(x) ((int)(x.size())) using namespace std; const int MOD = 1e9+7, LIM = 1e6+1, inf = 2e9; vi inside(LIM,0); void add(int p) { if (inside[p]) return; inside[p] = 1; move_inside(p); } void remove(int p) { if (!inside[p]) return; inside[p] = 0; move_outside(p); } int min_cardinality(int N) { vi machine; vi cand; for (int i = 0;i<N;i++) cand.push_back(i); while (1) { /* cerr << "C\n"; for (auto it : cand) cerr << it << ' '; cerr << '\n'; */ for (auto it : cand) add(it); int fnd = -1; int x = press_button(); for (auto it : cand) { remove(it); int y = press_button(); if (y == x) { fnd = it; break; } else add(it); } if (fnd == -1) return x; for (auto it : cand) remove(it); add(fnd); vi nxt{}; for (auto it : cand) { add(it); int y = press_button(); if (y == 1) { nxt.push_back(it); }else remove(it); } if (big(cand) == big(nxt)) return x; cand = nxt; if (cand.empty()) return x; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...