Submission #1126284

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
11262842024-12-12 16:59:32psm9352Cyberland (APIO23_cyberland)C++20
Compilation error
0 ms0 KiB
double solve(int N, int M, int K, int H, vector<int> x, vector<int>y, vector<int> c, vector<int> arr){
priority_queue<pair<double,int>,vector<pair<double,int>>,greater<pair<double,int>>> pq; // {val,node}
vector<vector<pair<int,double>>> graph(N);
for (int i = 0;i<M;i++){
graph[x[i]].push_back({y[i],c[i]});
graph[y[i]].push_back({x[i],c[i]});
}
pq.push({0.0,H});
vector<double> ans(N,1e18);ans[H]=0;
vector<int> visited(N,0);
while(!pq.empty()){
int node = pq.top().second;
pq.pop();
if (visited[node]){continue;}
visited[node]=1;
for (pair<int,double> next:graph[node]){
if (ans[node]+next.second<ans[next.first]){
ans[next.first]=next.second+ans[node];
pq.push({ans[next.first],next.first});
}
}
}
queue<int> q;
q.push(0);
vector<bool> pos(N,0);
for (int i = 0;i<N;i++){visited[i]=0;}
while(!q.empty()){
int node = q.front();q.pop();
if(visited[node]){continue;}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

cyberland.cpp:1:42: error: 'vector' has not been declared
    1 | double solve(int N, int M, int K, int H, vector<int> x, vector<int>y, vector<int> c, vector<int> arr){
      |                                          ^~~~~~
cyberland.cpp:1:48: error: expected ',' or '...' before '<' token
    1 | double solve(int N, int M, int K, int H, vector<int> x, vector<int>y, vector<int> c, vector<int> arr){
      |                                                ^
cyberland.cpp: In function 'double solve(int, int, int, int, int)':
cyberland.cpp:2:20: error: 'pair' was not declared in this scope
    2 |     priority_queue<pair<double,int>,vector<pair<double,int>>,greater<pair<double,int>>> pq; // {val,node}
      |                    ^~~~
cyberland.cpp:2:5: error: 'priority_queue' was not declared in this scope
    2 |     priority_queue<pair<double,int>,vector<pair<double,int>>,greater<pair<double,int>>> pq; // {val,node}
      |     ^~~~~~~~~~~~~~
cyberland.cpp:2:25: error: expected primary-expression before 'double'
    2 |     priority_queue<pair<double,int>,vector<pair<double,int>>,greater<pair<double,int>>> pq; // {val,node}
      |                         ^~~~~~
cyberland.cpp:3:12: error: 'vector' was not declared in this scope
    3 |     vector<vector<pair<int,double>>> graph(N);
      |            ^~~~~~
cyberland.cpp:3:24: error: expected primary-expression before 'int'
    3 |     vector<vector<pair<int,double>>> graph(N);
      |                        ^~~
cyberland.cpp:5:9: error: 'graph' was not declared in this scope
    5 |         graph[x[i]].push_back({y[i],c[i]});
      |         ^~~~~
cyberland.cpp:5:15: error: 'x' was not declared in this scope
    5 |         graph[x[i]].push_back({y[i],c[i]});
      |               ^
cyberland.cpp:5:32: error: 'y' was not declared in this scope
    5 |         graph[x[i]].push_back({y[i],c[i]});
      |                                ^
cyberland.cpp:5:37: error: 'c' was not declared in this scope
    5 |         graph[x[i]].push_back({y[i],c[i]});
      |                                     ^
cyberland.cpp:8:5: error: 'pq' was not declared in this scope
    8 |     pq.push({0.0,H});
      |     ^~
cyberland.cpp:9:12: error: expected primary-expression before 'double'
    9 |     vector<double> ans(N,1e18);ans[H]=0;
      |            ^~~~~~
cyberland.cpp:9:32: error: 'ans' was not declared in this scope
    9 |     vector<double> ans(N,1e18);ans[H]=0;
      |                                ^~~
cyberland.cpp:10:12: error: expected primary-expression before 'int'
   10 |     vector<int> visited(N,0);
      |            ^~~
cyberland.cpp:14:13: error: 'visited' was not declared in this scope
   14 |         if (visited[node]){continue;}
      |             ^~~~~~~
cyberland.cpp:15:9: error: 'visited' was not declared in this scope
   15 |         visited[node]=1;
      |         ^~~~~~~
cyberland.cpp:16:19: error: expected primary-expression before 'int'
   16 |         for (pair<int,double> next:graph[node]){
      |                   ^~~
cyberland.cpp:22:5: error: expected primary-expression before '}' token
   22 |     }
      |     ^
cyberland.cpp:21:10: error: expected ';' before '}' token
   21 |         }
      |          ^
      |          ;
   22 |     }
      |     ~     
cyberland.cpp:22:5: error: expected primary-expression before '}' token
   22 |     }
      |     ^
cyberland.cpp:21:10: error: expected ')' before '}' token
   21 |         }
      |          ^
      |          )
   22 |     }
      |     ~     
cyberland.cpp:16:13: note: to match this '('
   16 |         for (pair<int,double> next:graph[node]){
      |             ^
cyberland.cpp:22:5: error: expected primary-expression before '}' token
   22 |     }
      |     ^
cyberland.cpp:24:5: error: 'queue' was not declared in this scope
   24 |     queue<int> q;
      |     ^~~~~
cyberland.cpp:24:11: error: expected primary-expression before 'int'
   24 |     queue<int> q;
      |           ^~~
cyberland.cpp:25:5: error: 'q' was not declared in this scope
   25 |     q.push(0);
      |     ^
cyberland.cpp:26:12: error: expected primary-expression before 'bool'
   26 |     vector<bool> pos(N,0);
      |            ^~~~
cyberland.cpp:27:29: error: 'visited' was not declared in this scope
   27 |     for (int i = 0;i<N;i++){visited[i]=0;}
      |                             ^~~~~~~
cyberland.cpp:30:12: error: 'visited' was not declared in this scope
   30 |         if(visited[node]){continue;}
      |            ^~~~~~~
cyberland.cpp:31:9: error: 'visited' was not declared in this scope
   31 |         visited[node]=1;
      |         ^~~~~~~
cyberland.cpp:32:19: error: expected primary-expression before 'int'
   32 |         for (pair<int,double> next:graph[node]){
      |                   ^~~
cyberland.cpp:37:5: error: expected primary-expression before '}' token
   37 |     }
      |     ^
cyberland.cpp:36:10: error: expected ';' before '}' token
   36 |         }
      |          ^
      |          ;
   37 |     }
      |     ~     
cyberland.cpp:37:5: error: expected primary-expression before '}' token
   37 |     }
      |     ^
cyberland.cpp:36:10: error: expected ')' before '}' token
   36 |         }
      |          ^
      |          )
   37 |     }
      |     ~     
cyberland.cpp:32:13: note: to match this '('
   32 |         for (pair<int,double> next:graph[node]){
      |             ^
cyberland.cpp:37:5: error: expected primary-expression before '}' token
   37 |     }
      |     ^
cyberland.cpp:40:13: error: 'pos' was not declared in this scope
   40 |         if (pos[i]){ans[0]=min(ans[0],ans[i]);}
      |             ^~~
cyberland.cpp:40:28: error: 'min' was not declared in this scope
   40 |         if (pos[i]){ans[0]=min(ans[0],ans[i]);}
      |                            ^~~