Submission #1124189

#TimeUsernameProblemLanguageResultExecution timeMemory
1124189epicci23Rarest Insects (IOI22_insects)C++17
Compilation error
0 ms0 KiB
#include "insects.h" #include "bits/stdc++.h" using namespace std; vector<int> v,left; int D; void Clear(){ while(!v.empty()){ move_outside(v.back()); v.pop_back(); } } int min_cardinality(int n){ for(int i=0;i<n;i++){ v.push_back(i); move_inside(i); int u = press_button(); if(u == 1) continue; move_outside(i); v.pop_back(); } D = v.size(); for(int i=0;i<n;i++) left.push_back(i); if(D > n / 2) return 1; if(D == 1) return n; int _n = n; while(_n > D){ int B = _n / D; Clear(); for(int i=0;i<left.size();i++){ v.push_back(left[i]); move_inside(left[i]); int u = press_button(); if(u > B){ move_outside(left[i]); v.pop_back(); } } if(v.size() == B * D) return B; _n = v.size(); left = v; } return 1; }

Compilation message (stderr)

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:26:24: error: reference to 'left' is ambiguous
   26 |   for(int i=0;i<n;i++) left.push_back(i);
      |                        ^~~~
In file included from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from insects.cpp:2:
/usr/include/c++/11/bits/ios_base.h:1029:3: note: candidates are: 'std::ios_base& std::left(std::ios_base&)'
 1029 |   left(ios_base& __base)
      |   ^~~~
insects.cpp:5:15: note:                 'std::vector<int> left'
    5 | vector<int> v,left;
      |               ^~~~
insects.cpp:34:19: error: reference to 'left' is ambiguous
   34 |     for(int i=0;i<left.size();i++){
      |                   ^~~~
In file included from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from insects.cpp:2:
/usr/include/c++/11/bits/ios_base.h:1029:3: note: candidates are: 'std::ios_base& std::left(std::ios_base&)'
 1029 |   left(ios_base& __base)
      |   ^~~~
insects.cpp:5:15: note:                 'std::vector<int> left'
    5 | vector<int> v,left;
      |               ^~~~
insects.cpp:35:19: error: reference to 'left' is ambiguous
   35 |       v.push_back(left[i]);
      |                   ^~~~
In file included from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from insects.cpp:2:
/usr/include/c++/11/bits/ios_base.h:1029:3: note: candidates are: 'std::ios_base& std::left(std::ios_base&)'
 1029 |   left(ios_base& __base)
      |   ^~~~
insects.cpp:5:15: note:                 'std::vector<int> left'
    5 | vector<int> v,left;
      |               ^~~~
insects.cpp:36:19: error: reference to 'left' is ambiguous
   36 |       move_inside(left[i]);
      |                   ^~~~
In file included from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from insects.cpp:2:
/usr/include/c++/11/bits/ios_base.h:1029:3: note: candidates are: 'std::ios_base& std::left(std::ios_base&)'
 1029 |   left(ios_base& __base)
      |   ^~~~
insects.cpp:5:15: note:                 'std::vector<int> left'
    5 | vector<int> v,left;
      |               ^~~~
insects.cpp:39:22: error: reference to 'left' is ambiguous
   39 |         move_outside(left[i]);
      |                      ^~~~
In file included from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from insects.cpp:2:
/usr/include/c++/11/bits/ios_base.h:1029:3: note: candidates are: 'std::ios_base& std::left(std::ios_base&)'
 1029 |   left(ios_base& __base)
      |   ^~~~
insects.cpp:5:15: note:                 'std::vector<int> left'
    5 | vector<int> v,left;
      |               ^~~~
insects.cpp:45:5: error: reference to 'left' is ambiguous
   45 |     left = v;
      |     ^~~~
In file included from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from insects.cpp:2:
/usr/include/c++/11/bits/ios_base.h:1029:3: note: candidates are: 'std::ios_base& std::left(std::ios_base&)'
 1029 |   left(ios_base& __base)
      |   ^~~~
insects.cpp:5:15: note:                 'std::vector<int> left'
    5 | vector<int> v,left;
      |               ^~~~