Submission #1078086

#TimeUsernameProblemLanguageResultExecution timeMemory
1078086Faisal_SaqibRarest Insects (IOI22_insects)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; void move_inside(int i); void move_outside(int i); int press_button(); map<vector<int>,int> store; vector<int> cur,real_; void add(int i) { i--; cur.push_back(i); } void rem(int i) { i--; cur.pop_back(); } void khatam() { cur.clear(); } int ask() { if(store.find(cur)!=store.end())return store[cur]; for(auto&i:cur) { if(!binary_search(all(real),i)) { move_inside(i); } } for(auto&j:real_) { if(!binary_search(all(cur),i)) { move_outside(j); } } real_=cur; store[cur]=press_button(); // cout<<"asking \n"; // cout<<"For: "; // for(auto i:cur) // { // cout<<i<<' '; // } // cout<<endl; // cout<<"Ans: "<<store[cur]<<endl; return store[cur]; } int min_cardinality(int n) { vector<int> heads={1}; add(1); for(int i=2;i<=n;i++) { add(i); if(ask()==1) heads.push_back(i); else rem(i); } int sz=heads.size(); int s=1; int e=n+1; while(s+1<e) { int mid=(s+e)/2; khatam(); int sm=0; for(int i=1;i<=mid;i++) add(i),sm++; for(int j=mid+1;j<=n;j++) { add(j); if(ask()>mid) { rem(j); } else{ sm++; } } if(sm==((sz*mid))) { s=mid; } else{ e=mid; } } return s; }

Compilation message (stderr)

insects.cpp: In function 'int ask()':
insects.cpp:27:21: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   27 |   if(!binary_search(all(real),i))
      |                     ^~~
      |                     std::filesystem::perms::all
In file included from /usr/include/c++/10/filesystem:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from insects.cpp:1:
/usr/include/c++/10/bits/fs_fwd.h:148:7: note: 'std::filesystem::perms::all' declared here
  148 |       all  =  0777,
      |       ^~~
insects.cpp:34:21: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   34 |   if(!binary_search(all(cur),i))
      |                     ^~~
      |                     std::filesystem::perms::all
In file included from /usr/include/c++/10/filesystem:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from insects.cpp:1:
/usr/include/c++/10/bits/fs_fwd.h:148:7: note: 'std::filesystem::perms::all' declared here
  148 |       all  =  0777,
      |       ^~~
insects.cpp:34:30: error: 'i' was not declared in this scope
   34 |   if(!binary_search(all(cur),i))
      |                              ^