# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
628811 |
2022-08-13T17:30:07 Z |
a_aguilo |
Toll (BOI17_toll) |
C++14 |
|
886 ms |
524288 KB |
#include<bits/stdc++.h>
using namespace std;
void apsp(vector<vector<int>> & matrizAdyacencia) {
int N = (int) matrizAdyacencia.size();
for (int k = 0; k < N; k++){
for (int i = 0; i < N; i++){
for (int j = 0; j < N; j++)
matrizAdyacencia[i][j] = min(matrizAdyacencia[i][j], matrizAdyacencia[i][k] + matrizAdyacencia[k][j]);
}
}
}
int main(){
int K, N, M, O, t, a, b;
cin >> K >> N >> M >> O;
vector<vector<int>> G(N, vector<int>(N, 1e9+7));
for(int i = 0; i < N; ++i)G[i][i] = 0;
for(int i = 0; i < M; ++i){
cin >> a >> b >> t;
G[a][b] = t;
}
apsp(G);
while(O--){
cin >> a >> b;
if(G[a][b] == 1e9+7) cout << -1 << endl;
else cout << G[a][b]<< endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
205 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
194 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
831 ms |
4260 KB |
Output is correct |
7 |
Correct |
822 ms |
4256 KB |
Output is correct |
8 |
Correct |
847 ms |
4292 KB |
Output is correct |
9 |
Correct |
886 ms |
4280 KB |
Output is correct |
10 |
Runtime error |
192 ms |
524288 KB |
Execution killed with signal 9 |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
831 ms |
4260 KB |
Output is correct |
7 |
Correct |
822 ms |
4256 KB |
Output is correct |
8 |
Correct |
847 ms |
4292 KB |
Output is correct |
9 |
Correct |
886 ms |
4280 KB |
Output is correct |
10 |
Runtime error |
192 ms |
524288 KB |
Execution killed with signal 9 |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
205 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |