Submission #976331

#TimeUsernameProblemLanguageResultExecution timeMemory
976331kwongwengCyberland (APIO23_cyberland)C++17
15 / 100
38 ms7644 KiB
#include "cyberland.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> ii; typedef vector<ii> vii; typedef long double ld; typedef vector<vector<ll>> vll; #define FOR(i, a, b) for(int i = a; i < b; i++) #define ROF(i, a, b) for(int i = a; i >= b; i--) #define pb push_back #define ms memset #define fi first #define se second double solve(int N, int M, int K, int H, vi x, vi y, vi c, vi arr) { vii g[N]; FOR(i,0,M){ g[x[i]].pb({y[i],c[i]}); g[y[i]].pb({x[i],c[i]}); } vi used(N); vi bfs; bfs.pb(0); used[0]=1; FOR(i,0,bfs.size()){ int u = bfs[i]; for (ii edge : g[u]){ int v = edge.fi; if (used[v]) continue; bfs.pb(v); used[v]=1; } } if (!used[H]) return -1; vector<double> dist(N); set<pair<double,int>> st; st.insert({dist[0],0}); FOR(i,1,N){ if (arr[i]==0){ st.insert({dist[i],i}); }else{ dist[i]=1e18; } } while (!st.empty()){ int u = (*st.begin()).se; st.erase(st.begin()); for (ii edge : g[u]){ int v = edge.fi; int w = edge.se; if (dist[v] > dist[u] + w){ st.erase({dist[v],v}); dist[v] = dist[u]+w; st.insert({dist[v],v}); } } } return dist[H]; }

Compilation message (stderr)

cyberland.cpp: In function 'double solve(int, int, int, int, vi, vi, vi, vi)':
cyberland.cpp:10:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 | #define FOR(i, a, b) for(int i = a; i < b; i++)
......
   25 |     FOR(i,0,bfs.size()){
      |         ~~~~~~~~~~~~~~                 
cyberland.cpp:25:5: note: in expansion of macro 'FOR'
   25 |     FOR(i,0,bfs.size()){
      |     ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...