# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
385292 | 2021-04-04T03:25:54 Z | zoooma13 | Cheap flights (LMIO18_pigus_skrydziai) | C++14 | 665 ms | 77652 KB |
#include <bits/stdc++.h> using namespace std; int main() { int n ,m; scanf("%d%d",&n,&m); vector <vector<pair<int ,int>>> adj(n+1); map <int ,int> con[n+1]; for(int u,v,w,i=0; i<m; i++){ scanf("%d%d%d",&u,&v,&w); adj[u].push_back({w ,v}); adj[v].push_back({w ,u}); con[u][v] = w; con[v][u] = w; } int64_t ans = 0; for(int u = 1; u <= n; u++){ sort(adj[u].begin() ,adj[u].end()); int64_t tot = 0; for(auto&e : adj[u]) tot += e.first; if(adj[u].size() >= 2) tot = max(tot ,(int64_t)adj[u][0].first + adj[u][1].first + con[adj[u][0].second][adj[u][1].second]); ans = max(ans ,tot); } printf("%lld\n",ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 16 ms | 2944 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Incorrect | 1 ms | 364 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 16 ms | 2944 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Incorrect | 1 ms | 364 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 195 ms | 47468 KB | Output is correct |
2 | Correct | 510 ms | 77652 KB | Output is correct |
3 | Correct | 144 ms | 25964 KB | Output is correct |
4 | Correct | 306 ms | 50668 KB | Output is correct |
5 | Correct | 665 ms | 64620 KB | Output is correct |
6 | Correct | 99 ms | 15264 KB | Output is correct |
7 | Correct | 176 ms | 62188 KB | Output is correct |
8 | Correct | 189 ms | 63468 KB | Output is correct |
9 | Correct | 21 ms | 21612 KB | Output is correct |
10 | Correct | 96 ms | 15340 KB | Output is correct |
11 | Correct | 228 ms | 49316 KB | Output is correct |
12 | Correct | 198 ms | 30316 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 142 ms | 13164 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 195 ms | 47468 KB | Output is correct |
2 | Correct | 510 ms | 77652 KB | Output is correct |
3 | Correct | 144 ms | 25964 KB | Output is correct |
4 | Correct | 306 ms | 50668 KB | Output is correct |
5 | Correct | 665 ms | 64620 KB | Output is correct |
6 | Correct | 99 ms | 15264 KB | Output is correct |
7 | Correct | 176 ms | 62188 KB | Output is correct |
8 | Correct | 189 ms | 63468 KB | Output is correct |
9 | Correct | 21 ms | 21612 KB | Output is correct |
10 | Correct | 96 ms | 15340 KB | Output is correct |
11 | Correct | 228 ms | 49316 KB | Output is correct |
12 | Correct | 198 ms | 30316 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 142 ms | 13164 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 1 ms | 364 KB | Output is correct |
18 | Correct | 1 ms | 364 KB | Output is correct |
19 | Correct | 1 ms | 364 KB | Output is correct |
20 | Correct | 16 ms | 2944 KB | Output is correct |
21 | Correct | 1 ms | 364 KB | Output is correct |
22 | Correct | 1 ms | 364 KB | Output is correct |
23 | Correct | 1 ms | 364 KB | Output is correct |
24 | Incorrect | 1 ms | 364 KB | Output isn't correct |
25 | Halted | 0 ms | 0 KB | - |