Submission #1000044

#TimeUsernameProblemLanguageResultExecution timeMemory
1000044kunzaZa183Rarest Insects (IOI22_insects)C++17
10 / 100
289 ms428 KiB
#include "insects.h" #include <bits/stdc++.h> using namespace std; int min_cardinality(int N) { vector<int> cur; vector<int> each(N); int ct = 0; for (int i = 0; i < N; i++) { cur.push_back(i); move_inside(i); int res = press_button(); if (res == 1) each[i] = ct++; else { int sth; for (auto a : cur) { move_outside(a); res = press_button(); if (res == 1) { sth = a; each[i] = each[a]; break; } move_inside(a); } cur.erase(find(cur.begin(), cur.end(), sth)); } } map<int, int> mii; for (auto a : each) mii[a]++; vector<pair<int, int>> vpii; for (auto [a, b] : mii) vpii.emplace_back(b, a); sort(vpii.begin(), vpii.end()); // for (auto a : vpii) cout << a.first << ' ' << a.second << "\n"; // for (auto a : each) cout << a << ' '; // cout << "\n"; return vpii.front().first; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...