Submission #750886

#TimeUsernameProblemLanguageResultExecution timeMemory
750886blgutei000Cyberland (APIO23_cyberland)C++17
Compilation error
0 ms0 KiB
#include "cyberland.h" #include<bits/stdc++.h> #include <vector> #define ll long long #define pi pair<ll , ll> #define pb push_back #define mp make_pair #define ff first #define ss second #define sz size() const ll N = 1e18; const int maxn = 1e5 + 1; std::vector<pair<ll , ll> > adj[maxn]; std::vector<int> cost; int dist[maxn]; bool vis[maxn] , vis1[maxn]; std::set<pi> s; std::set<pi> :: iterator it; void dfs(int a) { vis[a] = true; for(int i = 0; i < adj[a].sz i++) { int b = adj[a][i].ff; if(arr[b] == 0) cost.pb(b); if(!vis[b]) dfs(b); } } double solve(int n, int m, int k, int h, std::vector<int> x, std::vector<int> y, std::vector<int> c, std::vector<int> arr) { for(int i = 0; i < m; i++) { adj[x[i]].pb(mp(y[i] , c[i])); adj[y[i]].pb(mp(x[i] , c[i])); } for(int i = 0; i < n; i++) { dist[i] = N; } dfs(0); dist[h - 1] = 0; s.insert(0 , h - 1); while(!s.empty()) { it = s.begin(); int u = it -> ss; s.erase(it); if(vis1[u]) continue; vis1[u] = true; for(int i = 0; i < adj[u].sz; i++) { int v = adj[u][i].ff; int w = adj[u][i].ss; if(dist[u] + w < dist[v]) { dist[v] = dist[u] + w; s.insert(mp(dist[v] , v)); } } } ll ans = 0; for(int i = 0; i < cost.sz i++) { if(ans < dist[cost[i]]) ans = dist[cost[i]]; } std::cout << ans << std::endl; return -1; }

Compilation message (stderr)

cyberland.cpp:16:13: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
   16 | std::vector<pair<ll , ll> > adj[maxn];
      |             ^~~~
      |             std::pair
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/vector:60,
                 from cyberland.h:1,
                 from cyberland.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:211:12: note: 'std::pair' declared here
  211 |     struct pair
      |            ^~~~
cyberland.cpp:16:25: error: template argument 1 is invalid
   16 | std::vector<pair<ll , ll> > adj[maxn];
      |                         ^
cyberland.cpp:16:25: error: template argument 2 is invalid
cyberland.cpp:16:27: error: expected unqualified-id before '>' token
   16 | std::vector<pair<ll , ll> > adj[maxn];
      |                           ^
cyberland.cpp:6:12: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    6 | #define pi pair<ll , ll>
      |            ^~~~
cyberland.cpp:20:10: note: in expansion of macro 'pi'
   20 | std::set<pi> s;
      |          ^~
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/vector:60,
                 from cyberland.h:1,
                 from cyberland.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:211:12: note: 'std::pair' declared here
  211 |     struct pair
      |            ^~~~
cyberland.cpp:6:24: error: template argument 1 is invalid
    6 | #define pi pair<ll , ll>
      |                        ^
cyberland.cpp:20:10: note: in expansion of macro 'pi'
   20 | std::set<pi> s;
      |          ^~
cyberland.cpp:6:24: error: template argument 2 is invalid
    6 | #define pi pair<ll , ll>
      |                        ^
cyberland.cpp:20:10: note: in expansion of macro 'pi'
   20 | std::set<pi> s;
      |          ^~
cyberland.cpp:6:24: error: template argument 3 is invalid
    6 | #define pi pair<ll , ll>
      |                        ^
cyberland.cpp:20:10: note: in expansion of macro 'pi'
   20 | std::set<pi> s;
      |          ^~
cyberland.cpp:20:12: error: expected unqualified-id before '>' token
   20 | std::set<pi> s;
      |            ^
cyberland.cpp:6:12: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    6 | #define pi pair<ll , ll>
      |            ^~~~
cyberland.cpp:21:10: note: in expansion of macro 'pi'
   21 | std::set<pi> :: iterator it;
      |          ^~
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/vector:60,
                 from cyberland.h:1,
                 from cyberland.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:211:12: note: 'std::pair' declared here
  211 |     struct pair
      |            ^~~~
cyberland.cpp:6:24: error: template argument 1 is invalid
    6 | #define pi pair<ll , ll>
      |                        ^
cyberland.cpp:21:10: note: in expansion of macro 'pi'
   21 | std::set<pi> :: iterator it;
      |          ^~
cyberland.cpp:6:24: error: template argument 2 is invalid
    6 | #define pi pair<ll , ll>
      |                        ^
cyberland.cpp:21:10: note: in expansion of macro 'pi'
   21 | std::set<pi> :: iterator it;
      |          ^~
cyberland.cpp:6:24: error: template argument 3 is invalid
    6 | #define pi pair<ll , ll>
      |                        ^
cyberland.cpp:21:10: note: in expansion of macro 'pi'
   21 | std::set<pi> :: iterator it;
      |          ^~
cyberland.cpp:21:12: error: expected unqualified-id before '>' token
   21 | std::set<pi> :: iterator it;
      |            ^
cyberland.cpp: In function 'void dfs(int)':
cyberland.cpp:24:21: error: 'adj' was not declared in this scope
   24 |  for(int i = 0; i < adj[a].sz i++) {
      |                     ^~~
cyberland.cpp:24:31: error: expected ';' before 'i'
   24 |  for(int i = 0; i < adj[a].sz i++) {
      |                               ^
cyberland.cpp:26:6: error: 'arr' was not declared in this scope
   26 |   if(arr[b] == 0) cost.pb(b);
      |      ^~~
cyberland.cpp: In function 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
cyberland.cpp:32:3: error: 'adj' was not declared in this scope
   32 |   adj[x[i]].pb(mp(y[i] , c[i]));
      |   ^~~
cyberland.cpp:8:12: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
    8 | #define mp make_pair
      |            ^~~~~~~~~
cyberland.cpp:32:16: note: in expansion of macro 'mp'
   32 |   adj[x[i]].pb(mp(y[i] , c[i]));
      |                ^~
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/vector:60,
                 from cyberland.h:1,
                 from cyberland.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:567:5: note: 'std::make_pair' declared here
  567 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
cyberland.cpp:36:13: warning: overflow in conversion from 'long long int' to 'int' changes value from '1000000000000000000' to '-1486618624' [-Woverflow]
   36 |   dist[i] = N;
      |             ^
cyberland.cpp:40:2: error: 's' was not declared in this scope
   40 |  s.insert(0 , h - 1);
      |  ^
cyberland.cpp:42:3: error: 'it' was not declared in this scope; did you mean 'int'?
   42 |   it = s.begin();
      |   ^~
      |   int
cyberland.cpp:47:22: error: 'adj' was not declared in this scope
   47 |   for(int i = 0; i < adj[u].sz; i++) {
      |                      ^~~
cyberland.cpp:8:12: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
    8 | #define mp make_pair
      |            ^~~~~~~~~
cyberland.cpp:52:14: note: in expansion of macro 'mp'
   52 |     s.insert(mp(dist[v] , v));
      |              ^~
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/vector:60,
                 from cyberland.h:1,
                 from cyberland.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:567:5: note: 'std::make_pair' declared here
  567 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
cyberland.cpp:57:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |  for(int i = 0; i < cost.sz i++) {
      |                   ^
cyberland.cpp:57:29: error: expected ';' before 'i'
   57 |  for(int i = 0; i < cost.sz i++) {
      |                             ^