# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
385293 | 2021-04-04T03:26:42 Z | zoooma13 | Cheap flights (LMIO18_pigus_skrydziai) | C++14 | 1369 ms | 80364 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].rbegin() ,adj[u].rend()); 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 | 15 ms | 2668 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 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 364 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 | 2 ms | 492 KB | Output is correct |
19 | Correct | 3 ms | 620 KB | Output is correct |
20 | Correct | 1 ms | 364 KB | Output is correct |
21 | Correct | 1 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | 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 | 15 ms | 2668 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 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 364 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 | 2 ms | 492 KB | Output is correct |
19 | Correct | 3 ms | 620 KB | Output is correct |
20 | Correct | 1 ms | 364 KB | Output is correct |
21 | Correct | 1 ms | 364 KB | Output is correct |
22 | Correct | 1369 ms | 66924 KB | Output is correct |
23 | Correct | 470 ms | 64236 KB | Output is correct |
24 | Correct | 20 ms | 3180 KB | Output is correct |
25 | Correct | 6 ms | 1260 KB | Output is correct |
26 | Correct | 6 ms | 1260 KB | Output is correct |
27 | Correct | 3 ms | 748 KB | Output is correct |
28 | Correct | 431 ms | 26860 KB | Output is correct |
29 | Correct | 121 ms | 10604 KB | Output is correct |
30 | Correct | 234 ms | 16364 KB | Output is correct |
31 | Correct | 2 ms | 492 KB | Output is correct |
32 | Correct | 2 ms | 492 KB | Output is correct |
33 | Correct | 477 ms | 65132 KB | Output is correct |
34 | Correct | 386 ms | 57580 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 193 ms | 44836 KB | Output is correct |
2 | Correct | 476 ms | 73196 KB | Output is correct |
3 | Correct | 142 ms | 24556 KB | Output is correct |
4 | Correct | 291 ms | 47852 KB | Output is correct |
5 | Correct | 656 ms | 60140 KB | Output is correct |
6 | Correct | 88 ms | 14188 KB | Output is correct |
7 | Correct | 175 ms | 58452 KB | Output is correct |
8 | Correct | 195 ms | 59116 KB | Output is correct |
9 | Correct | 19 ms | 21612 KB | Output is correct |
10 | Correct | 92 ms | 14188 KB | Output is correct |
11 | Correct | 230 ms | 46044 KB | Output is correct |
12 | Correct | 186 ms | 27884 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 163 ms | 12012 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 193 ms | 44836 KB | Output is correct |
2 | Correct | 476 ms | 73196 KB | Output is correct |
3 | Correct | 142 ms | 24556 KB | Output is correct |
4 | Correct | 291 ms | 47852 KB | Output is correct |
5 | Correct | 656 ms | 60140 KB | Output is correct |
6 | Correct | 88 ms | 14188 KB | Output is correct |
7 | Correct | 175 ms | 58452 KB | Output is correct |
8 | Correct | 195 ms | 59116 KB | Output is correct |
9 | Correct | 19 ms | 21612 KB | Output is correct |
10 | Correct | 92 ms | 14188 KB | Output is correct |
11 | Correct | 230 ms | 46044 KB | Output is correct |
12 | Correct | 186 ms | 27884 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 163 ms | 12012 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 | 15 ms | 2668 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 | Correct | 1 ms | 364 KB | Output is correct |
25 | Correct | 1 ms | 364 KB | Output is correct |
26 | Correct | 1 ms | 364 KB | Output is correct |
27 | Correct | 1 ms | 364 KB | Output is correct |
28 | Correct | 1 ms | 364 KB | Output is correct |
29 | Correct | 1 ms | 364 KB | Output is correct |
30 | Correct | 1 ms | 364 KB | Output is correct |
31 | Correct | 1 ms | 364 KB | Output is correct |
32 | Correct | 2 ms | 492 KB | Output is correct |
33 | Correct | 3 ms | 620 KB | Output is correct |
34 | Correct | 1 ms | 364 KB | Output is correct |
35 | Correct | 1 ms | 364 KB | Output is correct |
36 | Correct | 1369 ms | 66924 KB | Output is correct |
37 | Correct | 470 ms | 64236 KB | Output is correct |
38 | Correct | 20 ms | 3180 KB | Output is correct |
39 | Correct | 6 ms | 1260 KB | Output is correct |
40 | Correct | 6 ms | 1260 KB | Output is correct |
41 | Correct | 3 ms | 748 KB | Output is correct |
42 | Correct | 431 ms | 26860 KB | Output is correct |
43 | Correct | 121 ms | 10604 KB | Output is correct |
44 | Correct | 234 ms | 16364 KB | Output is correct |
45 | Correct | 2 ms | 492 KB | Output is correct |
46 | Correct | 2 ms | 492 KB | Output is correct |
47 | Correct | 477 ms | 65132 KB | Output is correct |
48 | Correct | 386 ms | 57580 KB | Output is correct |
49 | Correct | 405 ms | 32644 KB | Output is correct |
50 | Correct | 455 ms | 27800 KB | Output is correct |
51 | Correct | 535 ms | 38752 KB | Output is correct |
52 | Correct | 628 ms | 40908 KB | Output is correct |
53 | Correct | 194 ms | 25952 KB | Output is correct |
54 | Correct | 780 ms | 42288 KB | Output is correct |
55 | Correct | 482 ms | 80364 KB | Output is correct |
56 | Correct | 311 ms | 53356 KB | Output is correct |
57 | Correct | 524 ms | 57596 KB | Output is correct |
58 | Correct | 287 ms | 24148 KB | Output is correct |
59 | Correct | 608 ms | 46572 KB | Output is correct |
60 | Correct | 611 ms | 40780 KB | Output is correct |
61 | Correct | 681 ms | 37464 KB | Output is correct |