Submission #1000445

# Submission time Handle Problem Language Result Execution time Memory
1000445 2024-06-17T14:07:59 Z Mardonbekhazratov Closing Time (IOI23_closing) C++17
0 / 100
1000 ms 17128 KB
#include "closing.h"
#include<bits/stdc++.h>
#include <vector>

using namespace std;

#define ff first
#define ss second

vector<vector<pair<int,int>>>v;
vector<bool>vis;

int max_score(int N, int X, int Y, long long K,
              vector<int> U, vector<int> V, vector<int> W){
    v.resize(N);
    vis.assign(N,false);
    for(int i=0;i<N-1;i++){
        v[U[i]].push_back({V[i],W[i]});
        v[V[i]].push_back({U[i],W[i]});
    }
    priority_queue<pair<long long,int>>q;
    int ans=2;
    vis[X]=true;
    vis[Y]=true;
    for(auto [z,w]:v[X]) q.push({-w,z});
    for(auto [z,w]:v[Y]) q.push({-w,z});
    while(!q.empty()){
        auto [d,x]=q.top();
        q.pop();
        if(K+d<0){
            break;
        }
        K+=d;
        vis[x]=true;
        ans++;
        for(auto [z,w]:v[x]) if(!vis[z]) q.push({d-w,z});
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 52 ms 17128 KB Output is correct
2 Correct 52 ms 16820 KB Output is correct
3 Execution timed out 1060 ms 12944 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB 1st lines differ - on the 1st token, expected: '30', found: '19'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB 1st lines differ - on the 1st token, expected: '30', found: '19'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB 1st lines differ - on the 1st token, expected: '30', found: '19'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -