답안 #120836

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
120836 2019-06-25T15:50:38 Z Runtime_error_ 악어의 지하 도시 (IOI11_crocodile) C++14
46 / 100
298 ms 262144 KB
#include "crocodile.h"
#include <bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
const int inf=1e3+9,MX=1e9+9;
vector< pair<int,int> > adj[inf];
bool ex[inf];
int dp[inf];

void dfs(int u,int par){

    if(ex[u])
        return ;
    vector<int> tmp = {MX,MX,MX};
    for(auto v:adj[u])
        if( v.first != par )
            dfs(v.first , u) , tmp[2] = dp[v.first]+v.second,sort(tmp.begin(),tmp.end());
    dp[u] = tmp[1];
}

int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){

    for(int i=0;i<M;i++)
        adj[ R[i][0] ].push_back( make_pair( R[i][1] , L[i] ) ),
        adj[ R[i][1] ].push_back(make_pair( R[i][0] , L[i] ));

    for(int i=0;i<K;i++)
        ex[ P[i] ] = 1;
    dfs(0,-1);
    return dp[0];
}

# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 512 KB Output is correct
5 Correct 3 ms 512 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 512 KB Output is correct
8 Correct 2 ms 512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 512 KB Output is correct
5 Correct 3 ms 512 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 512 KB Output is correct
8 Correct 2 ms 512 KB Output is correct
9 Runtime error 298 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 512 KB Output is correct
5 Correct 3 ms 512 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 512 KB Output is correct
8 Correct 2 ms 512 KB Output is correct
9 Runtime error 298 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
10 Halted 0 ms 0 KB -