Submission #1065124

# Submission time Handle Problem Language Result Execution time Memory
1065124 2024-08-18T23:20:51 Z vjudge1 Closing Time (IOI23_closing) C++17
8 / 100
85 ms 34944 KB
#include "closing.h"
#include<bits/stdc++.h>
using namespace std;
vector<pair<int,int>>adj[200100];
vector<long long>v;
void dfs(int n,int p,long long d){
    v.push_back(d);
    for(auto[i,w]:adj[n])
        if(i-p)dfs(i,n,d+w);
}
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-1;i++)
        adj[U[i]].push_back({V[i],W[i]}),
        adj[V[i]].push_back({U[i],W[i]});
    v.clear();
    dfs(X,N,0);
    dfs(Y,N,0);
    sort(v.rbegin(),v.rend());
    while(v.size())
        if(v.back()<=K)
            K-=v.back(),
            v.pop_back();
        else break;
    for(int i=0;i<N;i++)
        adj[i].clear();
    return 2*N-v.size();
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4952 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 85 ms 30144 KB Output is correct
2 Correct 84 ms 34944 KB Output is correct
3 Correct 48 ms 10076 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 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 -
# Verdict Execution time Memory Grader output
1 Correct 1 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 -
# Verdict Execution time Memory Grader output
1 Correct 1 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 -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4952 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4952 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4952 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4952 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4952 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -