답안 #906482

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
906482 2024-01-14T10:50:07 Z pcc Cheap flights (LMIO18_pigus_skrydziai) C++17
28 / 100
2871 ms 124148 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(7123);
	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 36 ms 54372 KB Output is correct
2 Correct 38 ms 54352 KB Output is correct
3 Correct 37 ms 54436 KB Output is correct
4 Correct 47 ms 54356 KB Output is correct
5 Correct 41 ms 54388 KB Output is correct
6 Correct 1318 ms 57112 KB Output is correct
7 Correct 35 ms 54468 KB Output is correct
8 Correct 36 ms 54360 KB Output is correct
9 Correct 40 ms 54352 KB Output is correct
10 Correct 36 ms 54352 KB Output is correct
11 Correct 37 ms 54608 KB Output is correct
12 Correct 39 ms 54444 KB Output is correct
13 Correct 37 ms 54364 KB Output is correct
14 Correct 36 ms 54400 KB Output is correct
15 Correct 37 ms 54580 KB Output is correct
16 Correct 35 ms 54492 KB Output is correct
17 Correct 36 ms 54352 KB Output is correct
18 Correct 42 ms 54620 KB Output is correct
19 Correct 51 ms 54608 KB Output is correct
20 Correct 35 ms 54588 KB Output is correct
21 Correct 35 ms 54356 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 36 ms 54372 KB Output is correct
2 Correct 38 ms 54352 KB Output is correct
3 Correct 37 ms 54436 KB Output is correct
4 Correct 47 ms 54356 KB Output is correct
5 Correct 41 ms 54388 KB Output is correct
6 Correct 1318 ms 57112 KB Output is correct
7 Correct 35 ms 54468 KB Output is correct
8 Correct 36 ms 54360 KB Output is correct
9 Correct 40 ms 54352 KB Output is correct
10 Correct 36 ms 54352 KB Output is correct
11 Correct 37 ms 54608 KB Output is correct
12 Correct 39 ms 54444 KB Output is correct
13 Correct 37 ms 54364 KB Output is correct
14 Correct 36 ms 54400 KB Output is correct
15 Correct 37 ms 54580 KB Output is correct
16 Correct 35 ms 54492 KB Output is correct
17 Correct 36 ms 54352 KB Output is correct
18 Correct 42 ms 54620 KB Output is correct
19 Correct 51 ms 54608 KB Output is correct
20 Correct 35 ms 54588 KB Output is correct
21 Correct 35 ms 54356 KB Output is correct
22 Correct 2871 ms 117724 KB Output is correct
23 Correct 2676 ms 118176 KB Output is correct
24 Correct 307 ms 57536 KB Output is correct
25 Correct 65 ms 55384 KB Output is correct
26 Correct 65 ms 55388 KB Output is correct
27 Correct 44 ms 54924 KB Output is correct
28 Correct 2687 ms 82680 KB Output is correct
29 Correct 2653 ms 67056 KB Output is correct
30 Correct 2661 ms 70472 KB Output is correct
31 Correct 40 ms 54612 KB Output is correct
32 Correct 37 ms 54612 KB Output is correct
33 Correct 2749 ms 124148 KB Output is correct
34 Incorrect 2743 ms 117744 KB Output isn't correct
35 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 392 ms 71416 KB Output is correct
2 Correct 951 ms 86008 KB Output is correct
3 Correct 260 ms 65296 KB Output is correct
4 Correct 558 ms 74224 KB Output is correct
5 Correct 1426 ms 91600 KB Output is correct
6 Correct 2651 ms 69124 KB Output is correct
7 Correct 541 ms 78832 KB Output is correct
8 Correct 684 ms 86332 KB Output is correct
9 Correct 39 ms 56656 KB Output is correct
10 Correct 2648 ms 69120 KB Output is correct
11 Correct 716 ms 92560 KB Output is correct
12 Correct 2658 ms 84120 KB Output is correct
13 Correct 35 ms 54580 KB Output is correct
14 Correct 2665 ms 67228 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 392 ms 71416 KB Output is correct
2 Correct 951 ms 86008 KB Output is correct
3 Correct 260 ms 65296 KB Output is correct
4 Correct 558 ms 74224 KB Output is correct
5 Correct 1426 ms 91600 KB Output is correct
6 Correct 2651 ms 69124 KB Output is correct
7 Correct 541 ms 78832 KB Output is correct
8 Correct 684 ms 86332 KB Output is correct
9 Correct 39 ms 56656 KB Output is correct
10 Correct 2648 ms 69120 KB Output is correct
11 Correct 716 ms 92560 KB Output is correct
12 Correct 2658 ms 84120 KB Output is correct
13 Correct 35 ms 54580 KB Output is correct
14 Correct 2665 ms 67228 KB Output is correct
15 Correct 36 ms 54372 KB Output is correct
16 Correct 38 ms 54352 KB Output is correct
17 Correct 37 ms 54436 KB Output is correct
18 Correct 47 ms 54356 KB Output is correct
19 Correct 41 ms 54388 KB Output is correct
20 Correct 1318 ms 57112 KB Output is correct
21 Correct 35 ms 54468 KB Output is correct
22 Correct 36 ms 54360 KB Output is correct
23 Correct 40 ms 54352 KB Output is correct
24 Correct 36 ms 54352 KB Output is correct
25 Correct 37 ms 54608 KB Output is correct
26 Correct 39 ms 54444 KB Output is correct
27 Correct 37 ms 54364 KB Output is correct
28 Correct 36 ms 54400 KB Output is correct
29 Correct 37 ms 54580 KB Output is correct
30 Correct 35 ms 54492 KB Output is correct
31 Correct 36 ms 54352 KB Output is correct
32 Correct 42 ms 54620 KB Output is correct
33 Correct 51 ms 54608 KB Output is correct
34 Correct 35 ms 54588 KB Output is correct
35 Correct 35 ms 54356 KB Output is correct
36 Correct 2871 ms 117724 KB Output is correct
37 Correct 2676 ms 118176 KB Output is correct
38 Correct 307 ms 57536 KB Output is correct
39 Correct 65 ms 55384 KB Output is correct
40 Correct 65 ms 55388 KB Output is correct
41 Correct 44 ms 54924 KB Output is correct
42 Correct 2687 ms 82680 KB Output is correct
43 Correct 2653 ms 67056 KB Output is correct
44 Correct 2661 ms 70472 KB Output is correct
45 Correct 40 ms 54612 KB Output is correct
46 Correct 37 ms 54612 KB Output is correct
47 Correct 2749 ms 124148 KB Output is correct
48 Incorrect 2743 ms 117744 KB Output isn't correct
49 Halted 0 ms 0 KB -