답안 #795922

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
795922 2023-07-27T22:32:40 Z vjudge1 Cheap flights (LMIO18_pigus_skrydziai) C++17
12 / 100
3000 ms 105520 KB
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>

using namespace std;

#define mp make_pair
#define pb push_back
#define pii pair<int, int>

const int maxN = 1e6 + 10;

vector<pii> v[maxN];
long long cnt[maxN];
map<pii, int> mapa;
int n, m;

int main() {

    cin >> n >> m;
	

    for (int i = 1; i<=m; i++) {
    	int x, y, z;
    	scanf("%d%d%d", &x, &y, &z);
    	cnt[x]+=z;
    	cnt[y]+=z;
    	v[x].pb(mp(y,z));
    	v[y].pb(mp(x, z));
    	mapa[mp(x, y)] = z;
    	mapa[mp(y, x)] = z;
    }


    long long ans = 0;

    for (int i = 1; i<=n; i++) {
    	ans = max(ans, cnt[i]);
    }

    for (int x = 1; x<=n; x++) {
    	for (auto y : v[x]) {
    	for (auto z: v[y.first]) {
    			if (mapa.count(mp(x, z.first)))
    			ans = max(ans, 1ll * y.second + z.second + mapa[mp(x, z.first)]);
    		}
    	}
    }

    cout << ans << endl;

	return 0;
}

Compilation message

pigus_skrydziai.cpp: In function 'int main()':
pigus_skrydziai.cpp:27:11: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |      scanf("%d%d%d", &x, &y, &z);
      |      ~~~~~^~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 23708 KB Output is correct
2 Correct 13 ms 23720 KB Output is correct
3 Correct 13 ms 23764 KB Output is correct
4 Correct 12 ms 23764 KB Output is correct
5 Correct 13 ms 23808 KB Output is correct
6 Correct 525 ms 26936 KB Output is correct
7 Correct 14 ms 23764 KB Output is correct
8 Correct 12 ms 23764 KB Output is correct
9 Correct 14 ms 23776 KB Output is correct
10 Correct 13 ms 23764 KB Output is correct
11 Correct 14 ms 23772 KB Output is correct
12 Correct 13 ms 23792 KB Output is correct
13 Correct 13 ms 23764 KB Output is correct
14 Correct 13 ms 23772 KB Output is correct
15 Correct 13 ms 23796 KB Output is correct
16 Correct 12 ms 23732 KB Output is correct
17 Correct 12 ms 23792 KB Output is correct
18 Correct 15 ms 23928 KB Output is correct
19 Correct 18 ms 24064 KB Output is correct
20 Correct 13 ms 23800 KB Output is correct
21 Correct 13 ms 23764 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 23708 KB Output is correct
2 Correct 13 ms 23720 KB Output is correct
3 Correct 13 ms 23764 KB Output is correct
4 Correct 12 ms 23764 KB Output is correct
5 Correct 13 ms 23808 KB Output is correct
6 Correct 525 ms 26936 KB Output is correct
7 Correct 14 ms 23764 KB Output is correct
8 Correct 12 ms 23764 KB Output is correct
9 Correct 14 ms 23776 KB Output is correct
10 Correct 13 ms 23764 KB Output is correct
11 Correct 14 ms 23772 KB Output is correct
12 Correct 13 ms 23792 KB Output is correct
13 Correct 13 ms 23764 KB Output is correct
14 Correct 13 ms 23772 KB Output is correct
15 Correct 13 ms 23796 KB Output is correct
16 Correct 12 ms 23732 KB Output is correct
17 Correct 12 ms 23792 KB Output is correct
18 Correct 15 ms 23928 KB Output is correct
19 Correct 18 ms 24064 KB Output is correct
20 Correct 13 ms 23800 KB Output is correct
21 Correct 13 ms 23764 KB Output is correct
22 Execution timed out 3068 ms 105520 KB Time limit exceeded
23 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 253 ms 56540 KB Output is correct
2 Correct 621 ms 77584 KB Output is correct
3 Correct 153 ms 41456 KB Output is correct
4 Correct 354 ms 58748 KB Output is correct
5 Correct 952 ms 77288 KB Output is correct
6 Execution timed out 3080 ms 42624 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 253 ms 56540 KB Output is correct
2 Correct 621 ms 77584 KB Output is correct
3 Correct 153 ms 41456 KB Output is correct
4 Correct 354 ms 58748 KB Output is correct
5 Correct 952 ms 77288 KB Output is correct
6 Execution timed out 3080 ms 42624 KB Time limit exceeded
7 Halted 0 ms 0 KB -