Submission #712927

#TimeUsernameProblemLanguageResultExecution timeMemory
712927yuseok0803007 (CEOI14_007)C++14
Compilation error
0 ms0 KiB
#include <stdio.h> #include <vector> #include <queue> #include <set> #include <map> #include <algorithm> #include <stdlib.h> #include <string.h> #include <math.h> #include <stack> #include <ctype.h> #define p(x,y) pair<x, y> #define pii pair<int, int> #define v(x) vector<x> #define q(x) queue<x> #define pq(x) priority_queue<x> #define uppq(x, comp) priority_queue<x, vector<x>, comp> #define st(x) set<x> #define m(x, y) map<x, y> #define fi(s,e) for(int i=s;i<e;i++) #define fj(s,e) for(int j=s;j<e;j++) #define fk(s,e) for(int k=s;k<e;k++) typedef long long int ll; typedef unsigned long long int ull; typedef __int128 ulll; using namespace std; int n,m; int s,d,a,b; v(int) pushvec; v(v(int)) vec; int dista[200010], distb[200010]; void spreada(int x){ q(pii) qu; qu.push_back({{x,x}, 0}); while(!qu.empty()){ pii now = qu.front(); qu.pop(); if(now.second > dista[now.first.first] && dista[now.first.first] != -1) continue; dista[now.first.first]=now.second; int sz = vec[now.first.first].size(); fi(0,sz){ int next = vec[now.first.first][i]; if(next == now.first.second) continue; qu.push({{next, now.first.first}, now.second+1}); } } return; } void spreadb(int x){ q(pii) qu; qu.push_back({{x,x}, 0}); while(!qu.empty()){ pii now = qu.front(); qu.pop(); if(now.second > distb[now.first.first] && distb[now.first.first] != -1) continue; distb[now.first.first]=now.second; int sz = vec[now.first.first].size(); fi(0,sz){ int next = vec[now.first.first][i]; if(next == now.first.second) continue; qu.push({{next, now.first.first}, now.second+1}); } } return; } int find(int now){ int sz = vec[now].size(); int ans = dist[now]; fi(0,sz){ int next = vec[now][i]; if(dista[next]==dista[now]-1 && dista[next]==distb[next]){ ans = min(ans, find(next)); } } return ans; } int main(void){ scanf("%d%d%d%d%d%d",&n,&m,&s,&d,&a,&b); fi(0,n+1) vec.push_back(pushvec); fi(0,m){ int s,e; scanf("%d%d",&s,&e); vec[s].push_back(e); vec[e].push_back(s); } fi(1,n+1){ dista[i]=-1; distb[i]=-1; } spreada(a); spreadb(b); int ans = min(da[d]-da[s], db[d]-db[s]); if(da[s]==db[s] && db[s]==db[d]){ int divds, divdb; divds = find(s); divdb = find(d); if(divds > divdb) ans--; } printf("%d\n", max(ans, -1)); return 0; }

Compilation message (stderr)

007.cpp: In function 'void spreada(int)':
007.cpp:36:5: error: 'class std::queue<std::pair<int, int> >' has no member named 'push_back'
   36 |  qu.push_back({{x,x}, 0});
      |     ^~~~~~~~~
007.cpp:41:35: error: request for member 'first' in 'now.std::pair<int, int>::first', which is of non-class type 'int'
   41 |   if(now.second > dista[now.first.first] && dista[now.first.first] != -1) continue;
      |                                   ^~~~~
007.cpp:41:61: error: request for member 'first' in 'now.std::pair<int, int>::first', which is of non-class type 'int'
   41 |   if(now.second > dista[now.first.first] && dista[now.first.first] != -1) continue;
      |                                                             ^~~~~
007.cpp:43:19: error: request for member 'first' in 'now.std::pair<int, int>::first', which is of non-class type 'int'
   43 |   dista[now.first.first]=now.second;
      |                   ^~~~~
007.cpp:44:26: error: request for member 'first' in 'now.std::pair<int, int>::first', which is of non-class type 'int'
   44 |   int sz = vec[now.first.first].size();
      |                          ^~~~~
007.cpp:46:29: error: request for member 'first' in 'now.std::pair<int, int>::first', which is of non-class type 'int'
   46 |    int next = vec[now.first.first][i];
      |                             ^~~~~
007.cpp:47:25: error: request for member 'second' in 'now.std::pair<int, int>::first', which is of non-class type 'int'
   47 |    if(next == now.first.second) continue;
      |                         ^~~~~~
007.cpp:48:30: error: request for member 'first' in 'now.std::pair<int, int>::first', which is of non-class type 'int'
   48 |    qu.push({{next, now.first.first}, now.second+1});
      |                              ^~~~~
007.cpp:48:51: error: no matching function for call to 'std::queue<std::pair<int, int> >::push(<brace-enclosed initializer list>)'
   48 |    qu.push({{next, now.first.first}, now.second+1});
      |                                                   ^
In file included from /usr/include/c++/10/queue:64,
                 from 007.cpp:3:
/usr/include/c++/10/bits/stl_queue.h:265:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<int, int>]'
  265 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:265:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<int, int>&'}
  265 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_queue.h:270:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(std::queue<_Tp, _Sequence>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<int, int>]'
  270 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:270:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::queue<std::pair<int, int> >::value_type&&' {aka 'std::pair<int, int>&&'}
  270 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
007.cpp: In function 'void spreadb(int)':
007.cpp:56:5: error: 'class std::queue<std::pair<int, int> >' has no member named 'push_back'
   56 |  qu.push_back({{x,x}, 0});
      |     ^~~~~~~~~
007.cpp:61:35: error: request for member 'first' in 'now.std::pair<int, int>::first', which is of non-class type 'int'
   61 |   if(now.second > distb[now.first.first] && distb[now.first.first] != -1) continue;
      |                                   ^~~~~
007.cpp:61:61: error: request for member 'first' in 'now.std::pair<int, int>::first', which is of non-class type 'int'
   61 |   if(now.second > distb[now.first.first] && distb[now.first.first] != -1) continue;
      |                                                             ^~~~~
007.cpp:63:19: error: request for member 'first' in 'now.std::pair<int, int>::first', which is of non-class type 'int'
   63 |   distb[now.first.first]=now.second;
      |                   ^~~~~
007.cpp:64:26: error: request for member 'first' in 'now.std::pair<int, int>::first', which is of non-class type 'int'
   64 |   int sz = vec[now.first.first].size();
      |                          ^~~~~
007.cpp:66:29: error: request for member 'first' in 'now.std::pair<int, int>::first', which is of non-class type 'int'
   66 |    int next = vec[now.first.first][i];
      |                             ^~~~~
007.cpp:67:25: error: request for member 'second' in 'now.std::pair<int, int>::first', which is of non-class type 'int'
   67 |    if(next == now.first.second) continue;
      |                         ^~~~~~
007.cpp:68:30: error: request for member 'first' in 'now.std::pair<int, int>::first', which is of non-class type 'int'
   68 |    qu.push({{next, now.first.first}, now.second+1});
      |                              ^~~~~
007.cpp:68:51: error: no matching function for call to 'std::queue<std::pair<int, int> >::push(<brace-enclosed initializer list>)'
   68 |    qu.push({{next, now.first.first}, now.second+1});
      |                                                   ^
In file included from /usr/include/c++/10/queue:64,
                 from 007.cpp:3:
/usr/include/c++/10/bits/stl_queue.h:265:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<int, int>]'
  265 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:265:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<int, int>&'}
  265 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_queue.h:270:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(std::queue<_Tp, _Sequence>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<int, int>]'
  270 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:270:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::queue<std::pair<int, int> >::value_type&&' {aka 'std::pair<int, int>&&'}
  270 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
007.cpp: In function 'int find(int)':
007.cpp:76:12: error: 'dist' was not declared in this scope; did you mean 'distb'?
   76 |  int ans = dist[now];
      |            ^~~~
      |            distb
007.cpp: In function 'int main()':
007.cpp:105:16: error: 'da' was not declared in this scope; did you mean 'a'?
  105 |  int ans = min(da[d]-da[s], db[d]-db[s]);
      |                ^~
      |                a
007.cpp:105:29: error: 'db' was not declared in this scope; did you mean 'b'?
  105 |  int ans = min(da[d]-da[s], db[d]-db[s]);
      |                             ^~
      |                             b
007.cpp:87:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   87 |  scanf("%d%d%d%d%d%d",&n,&m,&s,&d,&a,&b);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
007.cpp:92:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   92 |   scanf("%d%d",&s,&e);
      |   ~~~~~^~~~~~~~~~~~~~