Submission #906446

# Submission time Handle Problem Language Result Execution time Memory
906446 2024-01-14T10:02:45 Z pcc Cheap flights (LMIO18_pigus_skrydziai) C++14
28 / 100
3000 ms 117956 KB
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace __gnu_pbds;
using namespace std;

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,popcnt")

#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>


const int mxn = 3e5+10;
int N,M;
cc_hash_table<int,ll> mp[mxn];
vector<tlll> edges;
ll sum[mxn];

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>N>>M;
	for(int i = 0;i<M;i++){
		int a,b,c;
		cin>>a>>b>>c;
		mp[a][b] = c;
		mp[b][a] = c;
		sum[a] += c;
		sum[b] += c;
		edges.push_back(make_tuple(a,b,c));
	}
	ll ans = *max_element(sum,sum+N+1);
	for(auto &i:edges){
		int a = get<0>(i),b = get<1>(i),ts = get<2>(i);
		if(mp[a].size()>mp[b].size())swap(a,b);
		for(auto &j:mp[a]){
			if(mp[b].find(j.fs) != mp[b].end()){
				ans = max(ans,mp[b][j.fs]+j.sc+ts);
			}
		}
	}
	cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 44 ms 54360 KB Output is correct
2 Correct 36 ms 54572 KB Output is correct
3 Correct 35 ms 54360 KB Output is correct
4 Correct 41 ms 54516 KB Output is correct
5 Correct 41 ms 54364 KB Output is correct
6 Correct 88 ms 57108 KB Output is correct
7 Correct 41 ms 54356 KB Output is correct
8 Correct 39 ms 54364 KB Output is correct
9 Correct 39 ms 54616 KB Output is correct
10 Correct 39 ms 54352 KB Output is correct
11 Correct 35 ms 54448 KB Output is correct
12 Correct 36 ms 54444 KB Output is correct
13 Correct 35 ms 54572 KB Output is correct
14 Correct 35 ms 54364 KB Output is correct
15 Correct 38 ms 54612 KB Output is correct
16 Correct 36 ms 54364 KB Output is correct
17 Correct 38 ms 54364 KB Output is correct
18 Correct 37 ms 54608 KB Output is correct
19 Correct 42 ms 54720 KB Output is correct
20 Correct 36 ms 54352 KB Output is correct
21 Correct 36 ms 54364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 44 ms 54360 KB Output is correct
2 Correct 36 ms 54572 KB Output is correct
3 Correct 35 ms 54360 KB Output is correct
4 Correct 41 ms 54516 KB Output is correct
5 Correct 41 ms 54364 KB Output is correct
6 Correct 88 ms 57108 KB Output is correct
7 Correct 41 ms 54356 KB Output is correct
8 Correct 39 ms 54364 KB Output is correct
9 Correct 39 ms 54616 KB Output is correct
10 Correct 39 ms 54352 KB Output is correct
11 Correct 35 ms 54448 KB Output is correct
12 Correct 36 ms 54444 KB Output is correct
13 Correct 35 ms 54572 KB Output is correct
14 Correct 35 ms 54364 KB Output is correct
15 Correct 38 ms 54612 KB Output is correct
16 Correct 36 ms 54364 KB Output is correct
17 Correct 38 ms 54364 KB Output is correct
18 Correct 37 ms 54608 KB Output is correct
19 Correct 42 ms 54720 KB Output is correct
20 Correct 36 ms 54352 KB Output is correct
21 Correct 36 ms 54364 KB Output is correct
22 Execution timed out 3037 ms 117956 KB Time limit exceeded
23 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 227 ms 72444 KB Output is correct
2 Correct 462 ms 85836 KB Output is correct
3 Correct 168 ms 65324 KB Output is correct
4 Correct 271 ms 73972 KB Output is correct
5 Correct 776 ms 90012 KB Output is correct
6 Correct 521 ms 69220 KB Output is correct
7 Correct 106 ms 78836 KB Output is correct
8 Correct 123 ms 85752 KB Output is correct
9 Correct 47 ms 56664 KB Output is correct
10 Correct 469 ms 69172 KB Output is correct
11 Correct 130 ms 92760 KB Output is correct
12 Correct 542 ms 83912 KB Output is correct
13 Correct 35 ms 54364 KB Output is correct
14 Correct 376 ms 67148 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 227 ms 72444 KB Output is correct
2 Correct 462 ms 85836 KB Output is correct
3 Correct 168 ms 65324 KB Output is correct
4 Correct 271 ms 73972 KB Output is correct
5 Correct 776 ms 90012 KB Output is correct
6 Correct 521 ms 69220 KB Output is correct
7 Correct 106 ms 78836 KB Output is correct
8 Correct 123 ms 85752 KB Output is correct
9 Correct 47 ms 56664 KB Output is correct
10 Correct 469 ms 69172 KB Output is correct
11 Correct 130 ms 92760 KB Output is correct
12 Correct 542 ms 83912 KB Output is correct
13 Correct 35 ms 54364 KB Output is correct
14 Correct 376 ms 67148 KB Output is correct
15 Correct 44 ms 54360 KB Output is correct
16 Correct 36 ms 54572 KB Output is correct
17 Correct 35 ms 54360 KB Output is correct
18 Correct 41 ms 54516 KB Output is correct
19 Correct 41 ms 54364 KB Output is correct
20 Correct 88 ms 57108 KB Output is correct
21 Correct 41 ms 54356 KB Output is correct
22 Correct 39 ms 54364 KB Output is correct
23 Correct 39 ms 54616 KB Output is correct
24 Correct 39 ms 54352 KB Output is correct
25 Correct 35 ms 54448 KB Output is correct
26 Correct 36 ms 54444 KB Output is correct
27 Correct 35 ms 54572 KB Output is correct
28 Correct 35 ms 54364 KB Output is correct
29 Correct 38 ms 54612 KB Output is correct
30 Correct 36 ms 54364 KB Output is correct
31 Correct 38 ms 54364 KB Output is correct
32 Correct 37 ms 54608 KB Output is correct
33 Correct 42 ms 54720 KB Output is correct
34 Correct 36 ms 54352 KB Output is correct
35 Correct 36 ms 54364 KB Output is correct
36 Execution timed out 3037 ms 117956 KB Time limit exceeded
37 Halted 0 ms 0 KB -