제출 #1124189

#제출 시각아이디문제언어결과실행 시간메모리
1124189epicci23드문 곤충 (IOI22_insects)C++17
컴파일 에러
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; }

컴파일 시 표준 에러 (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;
      |               ^~~~