제출 #923904

#제출 시각아이디문제언어결과실행 시간메모리
923904alexander707070Chameleon's Love (JOI20_chameleon)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "chameleon.h" #define MAXN 1007 using namespace std; namespace { int n,bad[MAXN],st,lt,rt,mid,li[MAXN],tim; vector<int> to[MAXN],v[MAXN]; vector< pair<int,int> > sol; vector<int> l,r,w,perm; void dfs(int x,int side){ li[x]=tim; if(side==0)l.push_back(x); else r.push_back(x); for(int i=0;i<v[x].size();i++){ if(li[v[x][i]]==tim)continue; dfs(v[x][i],1-side); } } } // namespace void Solve(int N) { n=N; for(int i=1;i<=2*n;i++){ for(int f=0;f<3;f++){ st=lt=rt; rt=l.size()+1; while(lt+1<rt){ mid=(lt+rt)/2; w.clear(); for(int i=st;i<mid;i++)w.push_back(l[i]); w.push_back(i); if(Query(w)!=w.size()){ rt=mid; }else{ lt=mid; } } if(rt!=l.size()+1){ v[i].push_back(v[l[rt-1]]); v[l[rt-1]].push_back(v[i]); } } for(int f=0;f<3;f++){ st=lt=rt; rt=r.size()+1; while(lt+1<rt){ mid=(lt+rt)/2; w.clear(); for(int i=st;i<mid;i++)w.push_back(r[i]); w.push_back(i); if(Query(w)!=w.size()){ rt=mid; }else{ lt=mid; } } if(rt!=r.size()+1){ v[i].push_back(v[r[rt-1]]); v[r[rt-1]].push_back(v[i]); } } l.clear(); r.clear(); tim++; for(int f=1;f<=2*n;f++){ if(li[f]!=tim)dfs(f,0); } } for(int i=1;i<=2*n;i++){ to[i]=v[i]; } for(int i=1;i<=2*n;i++){ if(to[i].empty())continue; if(to[i].size()==1)continue; else{ if(Query({i,to[i][0],to[i][1]})==1)bad[i]=to[i][2]; else if(Query({i,to[i][0],to[i][2]})==1)bad[i]=to[i][1]; else if(Query({i,to[i][2],to[i][1]})==1)bad[i]=to[i][0]; } } for(int i=1;i<=2*n;i++){ for(int f:to[i]){ if(bad[i]==f or bad[f]==i)continue; if(i<f)Answer(i,f); } } } /* 4 1 0 1 0 0 1 1 0 4 4 1 2 1 2 3 3 4 3 8 7 6 5 2 1 */

컴파일 시 표준 에러 (stderr) 메시지

chameleon.cpp: In function 'void {anonymous}::dfs(int, int)':
chameleon.cpp:21:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     for(int i=0;i<v[x].size();i++){
      |                 ~^~~~~~~~~~~~
chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:44:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |                 if(Query(w)!=w.size()){
      |                    ~~~~~~~~^~~~~~~~~~
chameleon.cpp:51:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |             if(rt!=l.size()+1){
      |                ~~^~~~~~~~~~~~
chameleon.cpp:52:42: error: no matching function for call to 'std::vector<int>::push_back(std::vector<int>&)'
   52 |                 v[i].push_back(v[l[rt-1]]);
      |                                          ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from chameleon.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const value_type&' {aka 'const int&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<int>::value_type&&' {aka 'int&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
chameleon.cpp:53:42: error: no matching function for call to 'std::vector<int>::push_back(std::vector<int>&)'
   53 |                 v[l[rt-1]].push_back(v[i]);
      |                                          ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from chameleon.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const value_type&' {aka 'const int&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<int>::value_type&&' {aka 'int&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
chameleon.cpp:66:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   66 |                 if(Query(w)!=w.size()){
      |                    ~~~~~~~~^~~~~~~~~~
chameleon.cpp:73:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   73 |             if(rt!=r.size()+1){
      |                ~~^~~~~~~~~~~~
chameleon.cpp:74:42: error: no matching function for call to 'std::vector<int>::push_back(std::vector<int>&)'
   74 |                 v[i].push_back(v[r[rt-1]]);
      |                                          ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from chameleon.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const value_type&' {aka 'const int&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<int>::value_type&&' {aka 'int&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
chameleon.cpp:75:42: error: no matching function for call to 'std::vector<int>::push_back(std::vector<int>&)'
   75 |                 v[r[rt-1]].push_back(v[i]);
      |                                          ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from chameleon.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const value_type&' {aka 'const int&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<int>::value_type&&' {aka 'int&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~