Submission #41887

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
418872018-02-22 05:04:30minhtung0404Commuter Pass (JOI18_commuter_pass)C++14
100 / 100
428 ms23744 KiB
//https://oj.uz/problem/view/JOI18_commuter_pass
#include<bits/stdc++.h>
const int N = 1e5 + 5;
const long long inf = 1e18 + 7;
using namespace std;
typedef pair <long long, int> ii;
vector <ii> adj[N];
vector <long long> dS, dU, dV;
int n, m, U, V, S, T;
long long MinU[N], MinV[N], ans;
bool visitT[N], visit[N];
void dijkstra(int S, vector <long long>& d){
d.assign(n+1, inf); d[S] = 0;
priority_queue <ii, vector <ii>, greater <ii>> mq; mq.push({d[S], S});
while (mq.size()){
ii z = mq.top(); mq.pop();
int u = z.second; long long val = z.first;
if (val != d[u]) continue;
for (int i = 0; i < adj[u].size(); i++){
int v = adj[u][i].second; long long cost = adj[u][i].first;
if (d[v] > d[u] + cost){
d[v] = d[u] + cost;
mq.push({d[v], v});
}
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

commuter_pass.cpp: In function 'void dijkstra(int, std::vector<long long int>&)':
commuter_pass.cpp:23:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i = 0; i < adj[u].size(); i++){
                           ^
commuter_pass.cpp: In function 'void dfs(int)':
commuter_pass.cpp:38:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < adj[u].size(); i++){
                       ^
commuter_pass.cpp: In function 'int main()':
commuter_pass.cpp:57:55: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d %d %d %d %d", &n, &m, &S, &T, &U, &V);
                                                       ^
commuter_pass.cpp:60:40: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d %lld", &u, &v, &c);
                                        ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...