Submission #1051178

#TimeUsernameProblemLanguageResultExecution timeMemory
1051178TrentRarest Insects (IOI22_insects)C++17
25 / 100
202 ms596 KiB
#include "insects.h" #include "bits/stdc++.h" using namespace std; #define forR(i, x) for(int i = 0; i < (x); ++i) #define REP(i, a, b) for(int i = (a); i < (b); ++i) #define all(x) x.begin(), x.end() typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vll; typedef vector<bool> vb; int INF = 1e7; int min_cardinality(int N) { vvi dst; set<int> vals; forR(i, N) vals.insert(i); while(dst.size() <= 1 || dst[dst.size() - 1].size() == dst[dst.size() - 2].size()) { dst.emplace_back(); for(int i : vals) { move_inside(i); if(press_button() == dst.size()) { dst.back().push_back(i); } else { move_outside(i); } } for(int i : dst.back()) vals.erase(vals.find(i)); if(dst.size() == 1 && dst.back().size() <= 32) { for(int i : dst.back()) move_outside(i); int mVal = INF; for(int i : dst.back()) { move_inside(i); int tot = 0; for(int j : vals) { move_inside(j); if(press_button() == 2) ++tot; move_outside(j); } mVal = min(mVal, tot + 1); move_outside(i); } return mVal; } } // for(vi& i : dst) { // for(int j : i) cerr << j << ' '; // cerr << '\n'; // } return dst.size() - 1; }

Compilation message (stderr)

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:22:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |       if(press_button() == dst.size()) {
      |          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...