제출 #293975

#제출 시각아이디문제언어결과실행 시간메모리
293975Dovran통행료 (IOI18_highway)C++11
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "highway.h" #define N 200009 #define pii pair <int, int> #define ff first #define ss second #define sz size #define pb push_back #define ll long long using namespace std; int n, m, ln; vector<int>e[N]; vector<int>asd; map<int, int>c[N]; int ansS, ansT; void find_pair(int NN, std::vector<int>u, std::vector<int>v, int a, int b){ n=NN; m=u.size(); for(int i=0; i<m; i++){ e[u[i]].pb(v[i]); e[v[i]].pb(u[i]); c[v[i]][u[i]]=i; c[u[i]][v[i]]=i; asd.pb(0); } ln=ask(asd); int l=0, r=m-1; int x, in; while(r>=l){ int md=(l+r)/2; for(int i = 0; i < m; i++) asd[i] = 0; for(int i=0; i<=md; i++) asd[i]=1; x=ask(asd); if(x==ln) l=md-1; else in = md, r=md+1; } queue<int> q; queue<int> q2; q.push(u[in]); q2.push(v[in]); int vis[N]; vis[u[in]]=1, vis[v[in]]=1; vector<int> p, p2; int lft=0, rgt=0; while(!q.empty() and !q2.empty()){ if(!lft){ p.clear(); int nd=q.front(); q.pop(); for(auto i:e[nd]) if(!vis[i]) vis[i]=vis[nd]+1, p.pb(i), q.push(i); sort(p.begin(), p.end()); for(int i=0; i<m; i++) asd[i]=0; for(auto i:p) for(auto j:e[i]) asd[c[i][j]]=1; x=ask(asd); if(x!=ln){ l=0, r=p.sz()-1; while(l>=r){ int md=(l+r)/2; for(int i=0; i<m; i++) asd[i]=0; for(int i=0; i<=md; i++) for(auto j:e[p[i]]) asd[c[p[i]][j]]=1; x=ask(asd); if(x!=ln) in=md, r=md-1; else l=md+1; } ansS=p[in]; lft=1; } } if(!rgt){ p2.clear(); int nd2=q2.front(); q2.pop(); for(auto i:e[nd2]) if(!vis[i]) vis[i]=vis[nd2]+1, p2.pb({vis[i], i}), q2.push(i); sort(p2.begin(), p2.end()); for(int i=0; i<m; i++) asd[i]=0; for(auto i:p2) for(auto j:e[i.ss]) asd[c[i.ss][j]]=1; x=ask(asd); if(ask(asd)!=ln){ l=0, r=p2.sz()-1; while(l>=r){ int md=(l+r)/2; for(int i=0; i<m; i++) asd[i]=0; for(int i=0; i<=md; i++) for(auto j:e[p2[i].ss]) asd[c[p2[i].ss][j]]=1; x=ask(asd); if(x!=ln) in=md, r=md-1; else l=md+1; } ansT=p2[in]; rgt=1; } } } answer(ansS, ansT); }

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

highway.cpp: In function 'void find_pair(int, std::vector<int>, std::vector<int>, int, int)':
highway.cpp:95:42: error: no matching function for call to 'std::vector<int>::push_back(<brace-enclosed initializer list>)'
   95 |      vis[i]=vis[nd2]+1, p2.pb({vis[i], i}), q2.push(i);
      |                                          ^
In file included from /usr/include/c++/9/vector:67,
                 from /usr/include/c++/9/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:86,
                 from highway.cpp:1:
/usr/include/c++/9/bits/stl_vector.h:1184: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]'
 1184 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/9/bits/stl_vector.h:1184:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const int&'}
 1184 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_vector.h:1200: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]'
 1200 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/9/bits/stl_vector.h:1200:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<int>::value_type&&' {aka 'int&&'}
 1200 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
highway.cpp:6:12: error: request for member 'second' in 'i', which is of non-class type 'int'
    6 | #define ss second
      |            ^~~~~~
highway.cpp:101:20: note: in expansion of macro 'ss'
  101 |     for(auto j:e[i.ss]) asd[c[i.ss][j]]=1;
      |                    ^~
highway.cpp:6:12: error: request for member 'second' in 'i', which is of non-class type 'int'
    6 | #define ss second
      |            ^~~~~~
highway.cpp:101:33: note: in expansion of macro 'ss'
  101 |     for(auto j:e[i.ss]) asd[c[i.ss][j]]=1;
      |                                 ^~
highway.cpp:6:12: error: request for member 'second' in 'p2.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
    6 | #define ss second
      |            ^~~~~~
highway.cpp:111:26: note: in expansion of macro 'ss'
  111 |       for(auto j:e[p2[i].ss]) asd[c[p2[i].ss][j]]=1;
      |                          ^~
highway.cpp:6:12: error: request for member 'second' in 'p2.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
    6 | #define ss second
      |            ^~~~~~
highway.cpp:111:43: note: in expansion of macro 'ss'
  111 |       for(auto j:e[p2[i].ss]) asd[c[p2[i].ss][j]]=1;
      |                                           ^~