# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
600719 |
2022-07-21T07:27:13 Z |
narvalo |
Ferries (NOI13_ferries) |
C++17 |
|
165 ms |
18668 KB |
#include <bits/stdc++.h>
using namespace std;
int ferries(int n , int m , vector<int> a , vector<int> b , vector<int> c) {
vector<vector<pair<int , int>>> adj(n);
for (int i = 0 ; i < m ; i++) {
a[i] -= 1 , b[i] -= 1;
adj[a[i]].emplace_back(b[i] , c[i]);
adj[b[i]].emplace_back(a[i] , c[i]);
}
sort(c.begin() , c.end());
int res = (int)1e9;
for (int i = 0 ; i < m ; i += 1) {
res = min(c[i] + c[m - 1 - i] , res);
}
return res;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n , m;
cin >> n >> m;
vector<int> a(m) , b(m) , c(m);
for (int i = 0 ; i < m ; i += 1) {
cin >> a[i] >> b[i] >> c[i];
}
cout << ferries(n , m , a , b , c) << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
2432 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
165 ms |
18668 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |