Submission #906445

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

#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 35 ms 54356 KB Output is correct
2 Correct 39 ms 54356 KB Output is correct
3 Correct 37 ms 54392 KB Output is correct
4 Correct 37 ms 54336 KB Output is correct
5 Correct 38 ms 54364 KB Output is correct
6 Correct 74 ms 57212 KB Output is correct
7 Correct 36 ms 54356 KB Output is correct
8 Correct 35 ms 54360 KB Output is correct
9 Correct 38 ms 54620 KB Output is correct
10 Correct 35 ms 54364 KB Output is correct
11 Correct 35 ms 54592 KB Output is correct
12 Correct 36 ms 54612 KB Output is correct
13 Correct 35 ms 54608 KB Output is correct
14 Correct 35 ms 54356 KB Output is correct
15 Correct 34 ms 54356 KB Output is correct
16 Correct 36 ms 54596 KB Output is correct
17 Correct 37 ms 54416 KB Output is correct
18 Correct 36 ms 54620 KB Output is correct
19 Correct 37 ms 54868 KB Output is correct
20 Correct 34 ms 54356 KB Output is correct
21 Correct 35 ms 54384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 35 ms 54356 KB Output is correct
2 Correct 39 ms 54356 KB Output is correct
3 Correct 37 ms 54392 KB Output is correct
4 Correct 37 ms 54336 KB Output is correct
5 Correct 38 ms 54364 KB Output is correct
6 Correct 74 ms 57212 KB Output is correct
7 Correct 36 ms 54356 KB Output is correct
8 Correct 35 ms 54360 KB Output is correct
9 Correct 38 ms 54620 KB Output is correct
10 Correct 35 ms 54364 KB Output is correct
11 Correct 35 ms 54592 KB Output is correct
12 Correct 36 ms 54612 KB Output is correct
13 Correct 35 ms 54608 KB Output is correct
14 Correct 35 ms 54356 KB Output is correct
15 Correct 34 ms 54356 KB Output is correct
16 Correct 36 ms 54596 KB Output is correct
17 Correct 37 ms 54416 KB Output is correct
18 Correct 36 ms 54620 KB Output is correct
19 Correct 37 ms 54868 KB Output is correct
20 Correct 34 ms 54356 KB Output is correct
21 Correct 35 ms 54384 KB Output is correct
22 Execution timed out 3055 ms 126548 KB Time limit exceeded
23 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 244 ms 73724 KB Output is correct
2 Correct 526 ms 90872 KB Output is correct
3 Correct 155 ms 66552 KB Output is correct
4 Correct 323 ms 77460 KB Output is correct
5 Correct 827 ms 93860 KB Output is correct
6 Correct 516 ms 70372 KB Output is correct
7 Correct 125 ms 82728 KB Output is correct
8 Correct 123 ms 89424 KB Output is correct
9 Correct 38 ms 56660 KB Output is correct
10 Correct 551 ms 70404 KB Output is correct
11 Correct 145 ms 95956 KB Output is correct
12 Correct 585 ms 86320 KB Output is correct
13 Correct 35 ms 54364 KB Output is correct
14 Correct 438 ms 68100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 244 ms 73724 KB Output is correct
2 Correct 526 ms 90872 KB Output is correct
3 Correct 155 ms 66552 KB Output is correct
4 Correct 323 ms 77460 KB Output is correct
5 Correct 827 ms 93860 KB Output is correct
6 Correct 516 ms 70372 KB Output is correct
7 Correct 125 ms 82728 KB Output is correct
8 Correct 123 ms 89424 KB Output is correct
9 Correct 38 ms 56660 KB Output is correct
10 Correct 551 ms 70404 KB Output is correct
11 Correct 145 ms 95956 KB Output is correct
12 Correct 585 ms 86320 KB Output is correct
13 Correct 35 ms 54364 KB Output is correct
14 Correct 438 ms 68100 KB Output is correct
15 Correct 35 ms 54356 KB Output is correct
16 Correct 39 ms 54356 KB Output is correct
17 Correct 37 ms 54392 KB Output is correct
18 Correct 37 ms 54336 KB Output is correct
19 Correct 38 ms 54364 KB Output is correct
20 Correct 74 ms 57212 KB Output is correct
21 Correct 36 ms 54356 KB Output is correct
22 Correct 35 ms 54360 KB Output is correct
23 Correct 38 ms 54620 KB Output is correct
24 Correct 35 ms 54364 KB Output is correct
25 Correct 35 ms 54592 KB Output is correct
26 Correct 36 ms 54612 KB Output is correct
27 Correct 35 ms 54608 KB Output is correct
28 Correct 35 ms 54356 KB Output is correct
29 Correct 34 ms 54356 KB Output is correct
30 Correct 36 ms 54596 KB Output is correct
31 Correct 37 ms 54416 KB Output is correct
32 Correct 36 ms 54620 KB Output is correct
33 Correct 37 ms 54868 KB Output is correct
34 Correct 34 ms 54356 KB Output is correct
35 Correct 35 ms 54384 KB Output is correct
36 Execution timed out 3055 ms 126548 KB Time limit exceeded
37 Halted 0 ms 0 KB -