Submission #744201

#TimeUsernameProblemLanguageResultExecution timeMemory
744201kwongwengRarest Insects (IOI22_insects)C++17
0 / 100
1 ms208 KiB
#include "insects.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> ii; typedef vector<ii> vii; typedef long double ld; typedef pair<ll, ll> pll; #define FOR(i, a, b) for(int i = a; i < b; i++) #define ROF(i, a, b) for(int i = a; i >= b; i--) #define ms memset #define pb push_back #define fi first #define se second #define mi(i) move_inside(i) #define mo(i) move_outside(i) #define pr press_button() int L = 1000; int min_cardinality(int n) { vi diff; vi used(n); FOR(i,0,n){ mi(i); int val = pr; if (val >= 2){ mo(i); }else{ diff.pb(i); used[i] = 1; } } int cnt = diff.size(); if (cnt <= L){ for (int u : diff) mo(u); vi num(cnt); FOR(i,0,n){ if (used[i]) continue; mi(i); FOR(j,0,cnt){ mi(diff[j]); if (pr >= 2){ num[j]++; } mo(diff[j]); } mo(i); } int mn = num[0]; FOR(i,0,cnt){ mn = min(mn, num[i]); } return mn; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...