Submission #575581

# Submission time Handle Problem Language Result Execution time Memory
575581 2022-06-11T05:43:18 Z Belgutei Dreaming (IOI13_dreaming) C++17
0 / 100
40 ms 12988 KB
#include "dreaming.h"
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mk make_pair
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define MOD 1000000007
#define MOD1 1000000009
#define sqr(x) sqr((x)*(x))

void debug_out() { cerr << endl; }
template<typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << ' ' << H; debug_out(T...); }
#ifdef BE_DEBUG
#define debug(...) cerr << "\033[1;31m(" << #__VA_ARGS__ << "):\033[0m", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

const int BB = 100005;

int par[BB];
vector<pair<int,int> > edge[BB];
bool visited[BB];
vector<int> v;
int a[BB],b[BB]; // 

void dfs(int node) {
    visited[node] = 1;
    v.pb(node);
    for(auto x: edge[node]) {
        if(visited[x.ff] == 1) continue;
        a[x.ff] = x.ss;
        dfs(x.ff);
        b[node] = max(b[node], a[x.ff]);
    }
    a[node] += b[node];
}

int travelTime(int N, int M, int L, int A[], int B[], int T[]) {
    for(int i = 0; i < N; i ++) {
        par[i] = i;
    }
    for(int i = 0; i < M; i ++) {
        edge[A[i]].pb({B[i], T[i]});
        edge[B[i]].pb({A[i], T[i]});
    }
    for(int i = 0; i < N; i ++) {
        if(visited[i] == 1) continue;
        v.clear();
        dfs(i);
    }
    /*
    for(int i = 0;  i < N; i ++) {
        cout << a[i] << ' ';
    }
    cout << '\n';
    */
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 12988 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 12988 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 6528 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 12988 KB Output isn't correct
2 Halted 0 ms 0 KB -