답안 #906451

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
906451 2024-01-14T10:08:24 Z pcc Cheap flights (LMIO18_pigus_skrydziai) C++14
28 / 100
2753 ms 119532 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.5*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(7122);
	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 54352 KB Output is correct
2 Correct 44 ms 54356 KB Output is correct
3 Correct 37 ms 54528 KB Output is correct
4 Correct 36 ms 54360 KB Output is correct
5 Correct 45 ms 54476 KB Output is correct
6 Correct 1361 ms 57092 KB Output is correct
7 Correct 38 ms 54356 KB Output is correct
8 Correct 45 ms 54440 KB Output is correct
9 Correct 40 ms 54604 KB Output is correct
10 Correct 34 ms 54364 KB Output is correct
11 Correct 38 ms 54864 KB Output is correct
12 Correct 36 ms 54616 KB Output is correct
13 Correct 36 ms 54356 KB Output is correct
14 Correct 37 ms 54364 KB Output is correct
15 Correct 37 ms 54356 KB Output is correct
16 Correct 36 ms 54608 KB Output is correct
17 Correct 43 ms 54344 KB Output is correct
18 Correct 42 ms 54620 KB Output is correct
19 Correct 53 ms 54608 KB Output is correct
20 Correct 44 ms 54352 KB Output is correct
21 Correct 37 ms 54580 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 36 ms 54352 KB Output is correct
2 Correct 44 ms 54356 KB Output is correct
3 Correct 37 ms 54528 KB Output is correct
4 Correct 36 ms 54360 KB Output is correct
5 Correct 45 ms 54476 KB Output is correct
6 Correct 1361 ms 57092 KB Output is correct
7 Correct 38 ms 54356 KB Output is correct
8 Correct 45 ms 54440 KB Output is correct
9 Correct 40 ms 54604 KB Output is correct
10 Correct 34 ms 54364 KB Output is correct
11 Correct 38 ms 54864 KB Output is correct
12 Correct 36 ms 54616 KB Output is correct
13 Correct 36 ms 54356 KB Output is correct
14 Correct 37 ms 54364 KB Output is correct
15 Correct 37 ms 54356 KB Output is correct
16 Correct 36 ms 54608 KB Output is correct
17 Correct 43 ms 54344 KB Output is correct
18 Correct 42 ms 54620 KB Output is correct
19 Correct 53 ms 54608 KB Output is correct
20 Correct 44 ms 54352 KB Output is correct
21 Correct 37 ms 54580 KB Output is correct
22 Correct 2753 ms 117680 KB Output is correct
23 Correct 2579 ms 113640 KB Output is correct
24 Correct 313 ms 57172 KB Output is correct
25 Correct 64 ms 55120 KB Output is correct
26 Correct 81 ms 55208 KB Output is correct
27 Correct 45 ms 54868 KB Output is correct
28 Correct 2593 ms 80072 KB Output is correct
29 Correct 2552 ms 65544 KB Output is correct
30 Correct 2565 ms 69128 KB Output is correct
31 Correct 39 ms 54644 KB Output is correct
32 Correct 38 ms 54612 KB Output is correct
33 Correct 2646 ms 119532 KB Output is correct
34 Incorrect 2634 ms 115964 KB Output isn't correct
35 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 366 ms 72796 KB Output is correct
2 Correct 905 ms 87400 KB Output is correct
3 Correct 268 ms 65280 KB Output is correct
4 Correct 569 ms 74296 KB Output is correct
5 Correct 1372 ms 90360 KB Output is correct
6 Correct 2549 ms 69264 KB Output is correct
7 Correct 552 ms 78776 KB Output is correct
8 Correct 624 ms 86004 KB Output is correct
9 Correct 40 ms 56872 KB Output is correct
10 Correct 2549 ms 69116 KB Output is correct
11 Correct 656 ms 93404 KB Output is correct
12 Correct 2562 ms 83956 KB Output is correct
13 Correct 35 ms 54360 KB Output is correct
14 Correct 2554 ms 67628 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 366 ms 72796 KB Output is correct
2 Correct 905 ms 87400 KB Output is correct
3 Correct 268 ms 65280 KB Output is correct
4 Correct 569 ms 74296 KB Output is correct
5 Correct 1372 ms 90360 KB Output is correct
6 Correct 2549 ms 69264 KB Output is correct
7 Correct 552 ms 78776 KB Output is correct
8 Correct 624 ms 86004 KB Output is correct
9 Correct 40 ms 56872 KB Output is correct
10 Correct 2549 ms 69116 KB Output is correct
11 Correct 656 ms 93404 KB Output is correct
12 Correct 2562 ms 83956 KB Output is correct
13 Correct 35 ms 54360 KB Output is correct
14 Correct 2554 ms 67628 KB Output is correct
15 Correct 36 ms 54352 KB Output is correct
16 Correct 44 ms 54356 KB Output is correct
17 Correct 37 ms 54528 KB Output is correct
18 Correct 36 ms 54360 KB Output is correct
19 Correct 45 ms 54476 KB Output is correct
20 Correct 1361 ms 57092 KB Output is correct
21 Correct 38 ms 54356 KB Output is correct
22 Correct 45 ms 54440 KB Output is correct
23 Correct 40 ms 54604 KB Output is correct
24 Correct 34 ms 54364 KB Output is correct
25 Correct 38 ms 54864 KB Output is correct
26 Correct 36 ms 54616 KB Output is correct
27 Correct 36 ms 54356 KB Output is correct
28 Correct 37 ms 54364 KB Output is correct
29 Correct 37 ms 54356 KB Output is correct
30 Correct 36 ms 54608 KB Output is correct
31 Correct 43 ms 54344 KB Output is correct
32 Correct 42 ms 54620 KB Output is correct
33 Correct 53 ms 54608 KB Output is correct
34 Correct 44 ms 54352 KB Output is correct
35 Correct 37 ms 54580 KB Output is correct
36 Correct 2753 ms 117680 KB Output is correct
37 Correct 2579 ms 113640 KB Output is correct
38 Correct 313 ms 57172 KB Output is correct
39 Correct 64 ms 55120 KB Output is correct
40 Correct 81 ms 55208 KB Output is correct
41 Correct 45 ms 54868 KB Output is correct
42 Correct 2593 ms 80072 KB Output is correct
43 Correct 2552 ms 65544 KB Output is correct
44 Correct 2565 ms 69128 KB Output is correct
45 Correct 39 ms 54644 KB Output is correct
46 Correct 38 ms 54612 KB Output is correct
47 Correct 2646 ms 119532 KB Output is correct
48 Incorrect 2634 ms 115964 KB Output isn't correct
49 Halted 0 ms 0 KB -