Submission #954864

#TimeUsernameProblemLanguageResultExecution timeMemory
954864ramalzaherCyberland (APIO23_cyberland)C++17
Compilation error
0 ms0 KiB
long long dis[N+4] , vis[N+4] , p[N+4] ; vector<pair<long long ,long long > > v[N+4] ; for(long long i = 0; i < M ; i ++ ){ v[x[i]].push_back({y[i] , c[i] }) ; v[y[i]].push_back({x[i] , c[i] }) ; } for(long long i = 0 ; i < N + 2 ; i ++ ) {dis[i] = 1e14 ;p[i] = -1; vis[i] = 0; } priority_queue<pair<long long ,long long > , vector<pair<long long ,long long > >, greater<pair<long long ,long long > > > q; q.push({0 ,1 });dis[1] = 0 ; while(q.size()){ long long top = q.top().second ; q.pop() ; long long node = top ; if(vis[node])continue ;vis[node] =1 ; for(auto it : v[top]){ if(it.second + dis[top] <= dis[it.first]){ p[it.first] = top ; dis[it.first] = it.second+dis[top] ; q.push({dis[it.first] , it.first}); } } } long long ans = dis[H] ; if(ans >= 1e14 ){ans = -1 ;}

Compilation message (stderr)

cyberland.cpp:1:15: error: 'N' was not declared in this scope
    1 | long long dis[N+4] , vis[N+4] , p[N+4] ;
      |               ^
cyberland.cpp:1:26: error: 'N' was not declared in this scope
    1 | long long dis[N+4] , vis[N+4] , p[N+4] ;
      |                          ^
cyberland.cpp:1:35: error: 'N' was not declared in this scope
    1 | long long dis[N+4] , vis[N+4] , p[N+4] ;
      |                                   ^
cyberland.cpp:2:1: error: 'vector' does not name a type
    2 | vector<pair<long long ,long long > > v[N+4] ;
      | ^~~~~~
cyberland.cpp:3:1: error: expected unqualified-id before 'for'
    3 | for(long long  i = 0; i < M ; i ++ ){
      | ^~~
cyberland.cpp:3:23: error: 'i' does not name a type
    3 | for(long long  i = 0; i < M ; i ++ ){
      |                       ^
cyberland.cpp:3:31: error: 'i' does not name a type
    3 | for(long long  i = 0; i < M ; i ++ ){
      |                               ^
cyberland.cpp:8:6: error: expected unqualified-id before 'for'
    8 |      for(long long  i = 0 ; i < N + 2 ; i ++ ) {dis[i] = 1e14 ;p[i] = -1; vis[i] = 0; }
      |      ^~~
cyberland.cpp:8:29: error: 'i' does not name a type
    8 |      for(long long  i = 0 ; i < N + 2 ; i ++ ) {dis[i] = 1e14 ;p[i] = -1; vis[i] = 0; }
      |                             ^
cyberland.cpp:8:41: error: 'i' does not name a type
    8 |      for(long long  i = 0 ; i < N + 2 ; i ++ ) {dis[i] = 1e14 ;p[i] = -1; vis[i] = 0; }
      |                                         ^
cyberland.cpp:9:2: error: 'priority_queue' does not name a type
    9 |  priority_queue<pair<long long ,long long >   , vector<pair<long long ,long long >  >, greater<pair<long long ,long long >    > > q;
      |  ^~~~~~~~~~~~~~
cyberland.cpp:10:4: error: 'q' does not name a type
   10 |    q.push({0 ,1 });dis[1] = 0 ;
      |    ^
cyberland.cpp:10:18: error: expected unqualified-id before ')' token
   10 |    q.push({0 ,1 });dis[1] = 0 ;
      |                  ^
cyberland.cpp:10:20: error: 'dis' does not name a type
   10 |    q.push({0 ,1 });dis[1] = 0 ;
      |                    ^~~
cyberland.cpp:11:4: error: expected unqualified-id before 'while'
   11 |    while(q.size()){
      |    ^~~~~
cyberland.cpp:23:22: error: 'dis' was not declared in this scope
   23 |     long long  ans = dis[H] ;
      |                      ^~~
cyberland.cpp:23:26: error: 'H' was not declared in this scope
   23 |     long long  ans = dis[H] ;
      |                          ^
cyberland.cpp:24:5: error: expected unqualified-id before 'if'
   24 |     if(ans >= 1e14 ){ans = -1 ;}
      |     ^~