답안 #998019

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
998019 2024-06-13T08:12:09 Z Geforgs Cheap flights (LMIO18_pigus_skrydziai) C++14
12 / 100
3000 ms 71764 KB
//#pragma GCC optimize("O3")
//#pragma GCC optimization("Ofast,unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
#include <bitset>
#include <string>
#include <cstring>
#include <stack>
//#include <ranges>

#define ll long long
#define ld long double
#define inf (ll)(2*1e18)
#define sort(a) sort(a.begin(), a.end())
#define reverse(a) reverse(a.begin(), a.end())
#define pb push_back
#define endl "\n"
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    srand(time(nullptr));
    ll n, m, x, y, w, i, ans=0, res;
    cin>>n>>m;
    vector<map<ll, ll>> a(n);
    for(i=0;i<m;++i){
        cin>>x>>y>>w;
        --x;
        --y;
        a[x][y] = w;
        a[y][x] = w;
    }
    for(i=0;i<n;++i){
        res = 0;
        for(auto it=a[i].begin();it!=a[i].end();advance(it, 1)){
            res += it->second;
        }
        ans = max(ans, res);
        for(auto it=a[i].begin();it!=a[i].end();advance(it, 1)){
            for(auto it2=a[i].begin();it2!=a[i].end();advance(it2, 1)){
                if(a[it->first].find(it2->first) != a[it->first].end()){
                    res = it->second + it2->second + a[it->first][it2->first];
                    ans = max(ans, res);
                }
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 213 ms 3180 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 2 ms 356 KB Output is correct
19 Correct 4 ms 604 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 213 ms 3180 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 2 ms 356 KB Output is correct
19 Correct 4 ms 604 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Execution timed out 3027 ms 71764 KB Time limit exceeded
23 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 68 ms 35412 KB Output is correct
2 Correct 205 ms 56376 KB Output is correct
3 Correct 42 ms 19036 KB Output is correct
4 Correct 101 ms 37068 KB Output is correct
5 Correct 338 ms 51536 KB Output is correct
6 Execution timed out 3069 ms 17236 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 68 ms 35412 KB Output is correct
2 Correct 205 ms 56376 KB Output is correct
3 Correct 42 ms 19036 KB Output is correct
4 Correct 101 ms 37068 KB Output is correct
5 Correct 338 ms 51536 KB Output is correct
6 Execution timed out 3069 ms 17236 KB Time limit exceeded
7 Halted 0 ms 0 KB -