Submission #932376

#TimeUsernameProblemLanguageResultExecution timeMemory
932376salmonShortcut (IOI16_shortcut)C++14
0 / 100
0 ms344 KiB
#include "shortcut.h" #include <bits/stdc++.h> using namespace std; queue<pair<int,int>> q; long long int d[1100100]; long long find_shortcut(int N, vector<int> l, vector<int> d, int c){ long long int small = 1e18; for(int i = 0; i < N; i++){ for(int j = i + 1; j < N; j++){ for(int k = 0; k < N; k++){ long long int big = 0; for(int i = 0; i < N; i++){ d[i] = 1e18; } q.push({0,k}); d[k] = 0; while(!q.empty()){ if(d[q.front().second] == q.front().first){ int m = q.front().second; if(m == j){ if(d[m] + c < d[i]){ d[i] = d[m] + c; q.push({d[i],i}); } } else if(m == i){ if(d[m] + c < d[j]){ d[j] = d[m] + c; q.push({d[j],j}); } } if(m != N - 1){ if(d[m + 1] > d[m] + l[m]){ d[m + 1] = d[m] + l[m]; q.push({d[m + 1], m + 1}); } } if(m != 0){ if(d[m - 1] > d[m] + l[m - 1]){ d[m - 1] = d[m - 1] + l[m - 1]; q.push({d[m - 1], m - 1}); } } } q.pop(); } for(int i = 0; i < N; i++){ big = max(big,(long long int)d[i]); } small = min(small,big); } } } return small; }

Compilation message (stderr)

shortcut.cpp: In function 'long long int find_shortcut(int, std::vector<int>, std::vector<int>, int)':
shortcut.cpp:20:28: warning: overflow in conversion from 'double' to '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} changes value from '1.0e+18' to '2147483647' [-Woverflow]
   20 |                     d[i] = 1e18;
      |                            ^~~~
#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...