답안 #840868

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
840868 2023-08-31T19:38:57 Z Mohmad_Zaid 봉쇄 시간 (IOI23_closing) C++17
0 / 100
164 ms 32440 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);
    int 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 96 ms 23408 KB Output is correct
2 Correct 164 ms 32440 KB Output is correct
3 Runtime error 57 ms 9912 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 -