답안 #906474

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
906474 2024-01-14T10:47:13 Z pcc Cheap flights (LMIO18_pigus_skrydziai) C++17
28 / 100
2888 ms 119508 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;
const int lim = 2.6*CLOCKS_PER_SEC;
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);
	int st = clock();
	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));
	}
	srand(time(NULL));
	random_shuffle(edges.begin(),edges.end());
	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(clock()-st>=lim)break;
			if(mp[b].find(j.fs) != mp[b].end()){
				ans = max(ans,mp[b][j.fs]+j.sc+ts);
			}
		}
		if(clock()-st>=lim)break;
	}
	cout<<ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 54360 KB Output is correct
2 Correct 34 ms 54364 KB Output is correct
3 Correct 36 ms 54360 KB Output is correct
4 Correct 38 ms 54416 KB Output is correct
5 Correct 35 ms 54356 KB Output is correct
6 Correct 1386 ms 57092 KB Output is correct
7 Correct 36 ms 54356 KB Output is correct
8 Correct 34 ms 54352 KB Output is correct
9 Correct 38 ms 54352 KB Output is correct
10 Correct 38 ms 54352 KB Output is correct
11 Correct 37 ms 54684 KB Output is correct
12 Correct 35 ms 54620 KB Output is correct
13 Correct 35 ms 54360 KB Output is correct
14 Correct 34 ms 54356 KB Output is correct
15 Correct 34 ms 54604 KB Output is correct
16 Correct 34 ms 54360 KB Output is correct
17 Correct 39 ms 54612 KB Output is correct
18 Correct 50 ms 54712 KB Output is correct
19 Correct 50 ms 54608 KB Output is correct
20 Correct 37 ms 54460 KB Output is correct
21 Correct 34 ms 54552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 54360 KB Output is correct
2 Correct 34 ms 54364 KB Output is correct
3 Correct 36 ms 54360 KB Output is correct
4 Correct 38 ms 54416 KB Output is correct
5 Correct 35 ms 54356 KB Output is correct
6 Correct 1386 ms 57092 KB Output is correct
7 Correct 36 ms 54356 KB Output is correct
8 Correct 34 ms 54352 KB Output is correct
9 Correct 38 ms 54352 KB Output is correct
10 Correct 38 ms 54352 KB Output is correct
11 Correct 37 ms 54684 KB Output is correct
12 Correct 35 ms 54620 KB Output is correct
13 Correct 35 ms 54360 KB Output is correct
14 Correct 34 ms 54356 KB Output is correct
15 Correct 34 ms 54604 KB Output is correct
16 Correct 34 ms 54360 KB Output is correct
17 Correct 39 ms 54612 KB Output is correct
18 Correct 50 ms 54712 KB Output is correct
19 Correct 50 ms 54608 KB Output is correct
20 Correct 37 ms 54460 KB Output is correct
21 Correct 34 ms 54552 KB Output is correct
22 Correct 2888 ms 117784 KB Output is correct
23 Correct 2673 ms 113716 KB Output is correct
24 Correct 336 ms 57096 KB Output is correct
25 Correct 63 ms 55128 KB Output is correct
26 Correct 63 ms 55212 KB Output is correct
27 Correct 46 ms 54844 KB Output is correct
28 Correct 2677 ms 81028 KB Output is correct
29 Correct 2650 ms 64776 KB Output is correct
30 Correct 2656 ms 69156 KB Output is correct
31 Correct 38 ms 54608 KB Output is correct
32 Correct 38 ms 54608 KB Output is correct
33 Correct 2741 ms 119508 KB Output is correct
34 Incorrect 2729 ms 115692 KB Output isn't correct
35 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 387 ms 72472 KB Output is correct
2 Correct 947 ms 86488 KB Output is correct
3 Correct 256 ms 65280 KB Output is correct
4 Correct 589 ms 74492 KB Output is correct
5 Correct 1364 ms 90992 KB Output is correct
6 Correct 2650 ms 69128 KB Output is correct
7 Correct 589 ms 78976 KB Output is correct
8 Correct 614 ms 87028 KB Output is correct
9 Correct 39 ms 56660 KB Output is correct
10 Correct 2652 ms 69192 KB Output is correct
11 Correct 691 ms 92628 KB Output is correct
12 Correct 2664 ms 83904 KB Output is correct
13 Correct 38 ms 54460 KB Output is correct
14 Correct 2673 ms 67180 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 387 ms 72472 KB Output is correct
2 Correct 947 ms 86488 KB Output is correct
3 Correct 256 ms 65280 KB Output is correct
4 Correct 589 ms 74492 KB Output is correct
5 Correct 1364 ms 90992 KB Output is correct
6 Correct 2650 ms 69128 KB Output is correct
7 Correct 589 ms 78976 KB Output is correct
8 Correct 614 ms 87028 KB Output is correct
9 Correct 39 ms 56660 KB Output is correct
10 Correct 2652 ms 69192 KB Output is correct
11 Correct 691 ms 92628 KB Output is correct
12 Correct 2664 ms 83904 KB Output is correct
13 Correct 38 ms 54460 KB Output is correct
14 Correct 2673 ms 67180 KB Output is correct
15 Correct 33 ms 54360 KB Output is correct
16 Correct 34 ms 54364 KB Output is correct
17 Correct 36 ms 54360 KB Output is correct
18 Correct 38 ms 54416 KB Output is correct
19 Correct 35 ms 54356 KB Output is correct
20 Correct 1386 ms 57092 KB Output is correct
21 Correct 36 ms 54356 KB Output is correct
22 Correct 34 ms 54352 KB Output is correct
23 Correct 38 ms 54352 KB Output is correct
24 Correct 38 ms 54352 KB Output is correct
25 Correct 37 ms 54684 KB Output is correct
26 Correct 35 ms 54620 KB Output is correct
27 Correct 35 ms 54360 KB Output is correct
28 Correct 34 ms 54356 KB Output is correct
29 Correct 34 ms 54604 KB Output is correct
30 Correct 34 ms 54360 KB Output is correct
31 Correct 39 ms 54612 KB Output is correct
32 Correct 50 ms 54712 KB Output is correct
33 Correct 50 ms 54608 KB Output is correct
34 Correct 37 ms 54460 KB Output is correct
35 Correct 34 ms 54552 KB Output is correct
36 Correct 2888 ms 117784 KB Output is correct
37 Correct 2673 ms 113716 KB Output is correct
38 Correct 336 ms 57096 KB Output is correct
39 Correct 63 ms 55128 KB Output is correct
40 Correct 63 ms 55212 KB Output is correct
41 Correct 46 ms 54844 KB Output is correct
42 Correct 2677 ms 81028 KB Output is correct
43 Correct 2650 ms 64776 KB Output is correct
44 Correct 2656 ms 69156 KB Output is correct
45 Correct 38 ms 54608 KB Output is correct
46 Correct 38 ms 54608 KB Output is correct
47 Correct 2741 ms 119508 KB Output is correct
48 Incorrect 2729 ms 115692 KB Output isn't correct
49 Halted 0 ms 0 KB -