답안 #1006745

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1006745 2024-06-24T08:13:32 Z Younis_Dwai 봉쇄 시간 (IOI23_closing) C++17
0 / 100
141 ms 40948 KB
#include "closing.h"
#include <bits/stdc++.h>
#include <vector>
#define ll long long
#define pb push_back
#define in insert
#define F first
#define S second
using namespace std;
const int NN=2e5+5;
int depth[NN];
vector<pair<int,int>> adj[NN];
multiset<int> s;
void dfs(int node , int par){
     s.in(depth[node]);
     for(auto u : adj[node]){
         if(u.F==par) continue ;
         depth[u.F]=depth[node]+u.S;
         dfs(u.F,node);
     }
     return ;
}
int max_score(int N, int X, int Y, long long K,std::vector<int> U, std::vector<int> V, std::vector<int> W){
    for(int i=0;i<N;i++){
        depth[i]=0;
        adj[i].clear();
    }
    s.clear();
    for(int i=0;i<N-1;i++){
            adj[U[i]].pb({V[i],W[i]});
            adj[V[i]].pb({U[i],W[i]});
    }
    int res=0;
    dfs(X,X);
    depth[Y]=0;
    dfs(Y,Y);
    while(s.size() && *s.begin()<=K){
          K-=*s.begin();
          res++;
          s.erase(s.begin());
    }
    return res;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4956 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 141 ms 40948 KB 1st lines differ - on the 1st token, expected: '451', found: '400000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 4956 KB Output is correct
2 Incorrect 1 ms 4956 KB 1st lines differ - on the 1st token, expected: '30', found: '24'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 4956 KB Output is correct
2 Incorrect 1 ms 4956 KB 1st lines differ - on the 1st token, expected: '30', found: '24'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 4956 KB Output is correct
2 Incorrect 1 ms 4956 KB 1st lines differ - on the 1st token, expected: '30', found: '24'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4956 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4956 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4956 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4956 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4956 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -