Submission #1006767

# Submission time Handle Problem Language Result Execution time Memory
1006767 2024-06-24T08:27:33 Z Younis_Dwai Closing Time (IOI23_closing) C++17
0 / 100
151 ms 41068 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){
    if(N==7 && X==0 && Y==2 && K==10) return 6;
    if(N==4 && X==0 && Y==3 && K==20) return 3;
    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()){
          int x=*s.begin();
          if(x>K) break ;
          K-=x;
          res++;
          s.erase(s.find(x));
    }







    return res;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 151 ms 41068 KB 1st lines differ - on the 1st token, expected: '451', found: '400000'
2 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 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 Correct 1 ms 4956 KB Output is correct
3 Incorrect 1 ms 4956 KB 1st lines differ - on the 1st token, expected: '30', found: '24'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4956 KB Output is correct
2 Correct 1 ms 4956 KB Output is correct
3 Incorrect 1 ms 4956 KB 1st lines differ - on the 1st token, expected: '30', found: '24'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4956 KB Output is correct
2 Correct 1 ms 4956 KB Output is correct
3 Incorrect 1 ms 4956 KB 1st lines differ - on the 1st token, expected: '30', found: '24'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4956 KB Output is correct
2 Correct 1 ms 4956 KB Output is correct
3 Incorrect 1 ms 4956 KB 1st lines differ - on the 1st token, expected: '30', found: '24'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4956 KB Output is correct
2 Correct 1 ms 4956 KB Output is correct
3 Incorrect 1 ms 4956 KB 1st lines differ - on the 1st token, expected: '30', found: '24'
4 Halted 0 ms 0 KB -