Submission #1232451

#TimeUsernameProblemLanguageResultExecution timeMemory
1232451dssfsuper2드문 곤충 (IOI22_insects)C++20
Compilation error
0 ms0 KiB
#include "insects.h" #include <bits/stdc++.h> using namespace std; set<int> ls; set<int> never; int inside=1; pair<set<int>, set<int>> putable(set<int>& available, int mk){ set<int> bigger; set<int> smaller; vector<int> te; for(auto thing:available){ //cout << thing << ' '; if(never.count(thing))continue; move_inside(thing); te.push_back(thing); inside++; if(press_button()>mk){ bigger.insert(thing); move_outside(thing); inside--; } else{ smaller.insert(thing); } } for(auto thing:te){ available.erase(thing); } for(auto thing:bigger)available.insert(thing); return {smaller, bigger}; } int min_cardinality(int N) { //dichotomie sur taille des grouppes max,c bien quand total tout est prenable,on "jette" les mauvais int T=1; vector<vector<int>> groups; groups.push_back({0}); move_inside(0); set<int> available; for(int i = 1;i<N;i++){ move_inside(i); inside++; if(press_button()==2){ move_outside(i); inside--; available.insert(i); } else{ T++; groups.push_back({i}); } } //cout << N << ' ' << T << '\n'; int res = 1; int left = 1; int right=(N+1)/T set<int> always; while(left!=right){ //cout << left << ' ' << right << '\n'; //for(auto thing:available)cout << thing << ' '; //cout << '\n'; int mid = left+(right-left)/2; auto x = putable(available, mid); //cout << inside << ' ' << mid << ' ' << T << '\n'; if(inside==(mid*T)){ //cout << inside << '\n'; //go higher for(auto thing:x.second){ available.insert(thing); } left=mid+1; for(int i = 0;i<N;i++)if(!available.count(i))always.insert(i); } else{ for(auto thing:x.second)never.insert(thing); for(auto thing:x.first){ if(!always.count(thing)){ move_outside(thing); available.insert(thing); inside--; } } right=mid; } } return left-1; }

Compilation message (stderr)

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:61:3: error: expected ',' or ';' before 'set'
   61 |   set<int> always;
      |   ^~~
insects.cpp:79:52: error: 'always' was not declared in this scope
   79 |       for(int i = 0;i<N;i++)if(!available.count(i))always.insert(i);
      |                                                    ^~~~~~
insects.cpp:84:13: error: 'always' was not declared in this scope
   84 |         if(!always.count(thing)){
      |             ^~~~~~