답안 #840866

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
840866 2023-08-31T19:38:33 Z Mohmad_Zaid 봉쇄 시간 (IOI23_closing) C++17
0 / 100
136 ms 32432 KB
// #include "closing.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back

vector<vector<pair<int,int>>>g;
vector<bool>vis;
set<ll>dis;
void dfs(int p,int v,ll k,ll curr){
    for(auto i:g[v]){
        if(i.first==p || vis[i.first])continue;
        if(i.second+curr>k)break;
        vis[i.first]=1;
        dis.insert(curr+i.second);
        dfs(v,i.first,k,curr+i.second);
    }
}
int max_score(int N, int X, int Y, long long K,vector<int> U, vector<int> V, vector<int> W)
{
    int n=N;
    dis.clear();
    vis.resize(n,0);
    g.resize(n,vector<pair<int,int>>());
    for(int i=0;i<n;i++){
        g[U[i]].pb({V[i],W[i]});
        g[V[i]].pb({U[i],W[i]});
    }
    dfs(X,X,K,0);
    dfs(Y,Y,K,0);
    ll ans=0;
    for(auto i:dis){
        if(i>K)break;
        ans++;
        K-=i;
    }

    return ans+2;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 81 ms 23384 KB Output is correct
2 Correct 136 ms 32432 KB Output is correct
3 Runtime error 46 ms 9900 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -