Submission #198457

# Submission time Handle Problem Language Result Execution time Memory
198457 2020-01-26T06:24:46 Z oolimry Cheap flights (LMIO18_pigus_skrydziai) C++14
12 / 100
3000 ms 220116 KB
#include <bits/stdc++.h>

using namespace std;
typedef pair<int,long long> ii; 
static vector<ii> adj[500005];

map<ii, long long> edges;
int main(){
	//freopen("i.txt","r",stdin);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n, m; cin >> n >> m;
	
	for(int b = 0;b < n;b++){
		for(int c = 0;c < n;c++){
			edges[ii(b,c)] = -1238213829038LL;
		}
	}

	for(int i = 0;i < m;i++){
		int u, v; long long w;
		cin >> u >> v >> w; u--; v--;
		adj[u].push_back(ii(v,w));
		adj[v].push_back(ii(u,w));
		edges[ii(u,v)] = w;
		edges[ii(v,u)] = w;
	}
	
	long long ans = 0;
	
	for(int i = 0;i < n;i++){
		long long acc = 0;
		for(ii v : adj[i]) acc += v.second;
		ans = max(ans, acc);
	}
	
	
	for(int a = 0;a < n;a++){
		for(int b = 0;b < n;b++){
			for(int c = 0;c < n;c++){
				ans = max(ans, edges[ii(a,b)] + edges[ii(c,b)] + edges[ii(a,c)]);
			}
		}
	}
	
	
	cout << ans;
}



# Verdict Execution time Memory Grader output
1 Correct 13 ms 12152 KB Output is correct
2 Correct 14 ms 12024 KB Output is correct
3 Correct 12 ms 12152 KB Output is correct
4 Correct 13 ms 12152 KB Output is correct
5 Correct 14 ms 12152 KB Output is correct
6 Correct 2826 ms 15736 KB Output is correct
7 Correct 13 ms 12152 KB Output is correct
8 Correct 12 ms 12024 KB Output is correct
9 Correct 17 ms 12156 KB Output is correct
10 Correct 19 ms 12152 KB Output is correct
11 Correct 1965 ms 14072 KB Output is correct
12 Correct 1092 ms 13688 KB Output is correct
13 Correct 1996 ms 14200 KB Output is correct
14 Correct 13 ms 12024 KB Output is correct
15 Correct 12 ms 12024 KB Output is correct
16 Correct 13 ms 12152 KB Output is correct
17 Correct 13 ms 12024 KB Output is correct
18 Correct 303 ms 12792 KB Output is correct
19 Correct 2836 ms 14764 KB Output is correct
20 Correct 1998 ms 14160 KB Output is correct
21 Correct 12 ms 12024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 12152 KB Output is correct
2 Correct 14 ms 12024 KB Output is correct
3 Correct 12 ms 12152 KB Output is correct
4 Correct 13 ms 12152 KB Output is correct
5 Correct 14 ms 12152 KB Output is correct
6 Correct 2826 ms 15736 KB Output is correct
7 Correct 13 ms 12152 KB Output is correct
8 Correct 12 ms 12024 KB Output is correct
9 Correct 17 ms 12156 KB Output is correct
10 Correct 19 ms 12152 KB Output is correct
11 Correct 1965 ms 14072 KB Output is correct
12 Correct 1092 ms 13688 KB Output is correct
13 Correct 1996 ms 14200 KB Output is correct
14 Correct 13 ms 12024 KB Output is correct
15 Correct 12 ms 12024 KB Output is correct
16 Correct 13 ms 12152 KB Output is correct
17 Correct 13 ms 12024 KB Output is correct
18 Correct 303 ms 12792 KB Output is correct
19 Correct 2836 ms 14764 KB Output is correct
20 Correct 1998 ms 14160 KB Output is correct
21 Correct 12 ms 12024 KB Output is correct
22 Execution timed out 3342 ms 182660 KB Time limit exceeded
23 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3210 ms 220116 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3210 ms 220116 KB Time limit exceeded
2 Halted 0 ms 0 KB -