답안 #1078350

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1078350 2024-08-27T15:43:30 Z vjudge1 봉쇄 시간 (IOI23_closing) C++17
8 / 100
114 ms 27988 KB
#include "closing.h"
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0);    cin.tie(0);
#define vi vector<int>
#define ll long long
#define ff first
#define ss second
using namespace std;
const int MAX=2e5+5;
vector<pair<int,int>> v[MAX];
ll maxi=0;
ll D[MAX];
ll R[MAX];
void dfs(int u,int p){
    for(auto it:v[u]){
        if(it.ff==p)   continue;
        D[it.ff]=D[u]+it.ss;
        dfs(it.ff,u);
    }

}

int max_score(int n,int x,int y, ll k,vi u,vi l, vi w){
    for(int i=0;i<n-1;i++){
        v[u[i]].push_back({l[i],w[i]});
        v[l[i]].push_back({u[i],w[i]});
    }
    maxi=k;
    D[x]=0;
    dfs(x,-1);
    for(int i=0;i<n;i++){
        R[i]=D[i];
    }
    D[y]=0;
    dfs(y,-1);
    for(int i=0;i<n;i++){
        R[i]=min(D[i],R[i]);
        ///cout<<R[i]<<" ";
    }
    sort(R,R+n);
    ll awa=0;
    int ans=0;
    for(int i=0;i<n;i++){
        if(awa+R[i]<=k){
            awa+=R[i];
            ans++;
        }
        else    break;
    }
    for(int i=0;i<n;i++){
        v[i].clear();
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4956 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 81 ms 22340 KB Output is correct
2 Correct 114 ms 27988 KB Output is correct
3 Correct 52 ms 12172 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 5976 KB Output is correct
2 Incorrect 2 ms 4956 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 5976 KB Output is correct
2 Incorrect 2 ms 4956 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 5976 KB Output is correct
2 Incorrect 2 ms 4956 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4956 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4956 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4956 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4956 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4956 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -