답안 #398995

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
398995 2021-05-05T02:06:37 Z jlallas384 꿈 (IOI13_dreaming) C++14
10 / 100
1000 ms 7492 KB
#include <bits/stdc++.h>
#include "dreaming.h"
using namespace std;

int travelTime(int n, int m, int l, int A[], int B[], int T[]) {
    vector<vector<pair<int,int>>> g(n);
    for(int i = 0; i < m; i++){
        g[A[i]].emplace_back(B[i],T[i]);
        g[B[i]].emplace_back(A[i],T[i]);
    }
    vector<int> vis(n),mins;
    int ans = 0;
    for(int i = 0; i < n; i++) if(!vis[i]){
        queue<int> q;
        q.push(i);
        vis[i] = 1;
        vector<int> comp;
        while(q.size()){
            int v = q.front(); q.pop();
            comp.push_back(v);
            for(auto [u,w]: g[v]) if(!vis[u]){
                q.push(u);
                vis[u] = 1;
            }
        }
        int mn = 1e9;
        for(int st: comp){
            queue<tuple<int,int,int>> q;
            q.emplace(st,-1,0);
            int mx = 0;
            while(q.size()){
                auto [v,p,dst] = q.front(); q.pop();
                mx = max(mx,dst);
                ans = max(ans,dst);
                for(auto [u,w]: g[v]) if(u != p){
                    q.emplace(u,v,w+dst);
                }
            }
            mn = min(mn,mx);
        }
        mins.push_back(mn);
    }
    sort(mins.rbegin(), mins.rend());
    ans = max(ans,mins[0] + l + mins[1]);
    return ans;
}

Compilation message

dreaming.cpp: In function 'int travelTime(int, int, int, int*, int*, int*)':
dreaming.cpp:21:22: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   21 |             for(auto [u,w]: g[v]) if(!vis[u]){
      |                      ^
dreaming.cpp:32:22: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   32 |                 auto [v,p,dst] = q.front(); q.pop();
      |                      ^
dreaming.cpp:35:26: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   35 |                 for(auto [u,w]: g[v]) if(u != p){
      |                          ^
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1092 ms 7492 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 308 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 304 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1092 ms 7492 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 34 ms 5632 KB Output is correct
2 Incorrect 40 ms 5976 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 308 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 304 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 208 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 2 ms 460 KB Output is correct
28 Correct 4 ms 460 KB Output is correct
29 Correct 1 ms 336 KB Output is correct
30 Correct 3 ms 440 KB Output is correct
31 Correct 5 ms 572 KB Output is correct
32 Incorrect 2 ms 336 KB Output isn't correct
33 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1092 ms 7492 KB Time limit exceeded
2 Halted 0 ms 0 KB -