Submission #1006726

# Submission time Handle Problem Language Result Execution time Memory
1006726 2024-06-24T07:49:38 Z De3b0o Closing Time (IOI23_closing) C++17
0 / 100
59 ms 25376 KB
#include "closing.h"
#include<bits/stdc++.h>
#include<random>
#define ll long long
#define F first
#define S second
#define in insert
#define pb push_back
#define ppb pop_back()
#define d3 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define cans cout << ans << "\n";
#define yes cout << "Yes" << "\n";
#define no cout << "No" << "\n";
#define pll pair<ll,ll>
#define lin cout << "\n";
#define sqr 340
#define mod 1000000007
#define mid ((l+r)/2)
#define lc (2*n)
#define rc (2*n+1)

using namespace std;

ll n , x , y , k;
vector<pll> adj[200009];
ll vis[200009];

int max_score(int N, int X, int Y, long long K,std::vector<int> U, std::vector<int> V, std::vector<int> W)
{
    n=N;
    x=X;
    y=Y;
    k=K;
    for(int i = 0 ; n-1>i ; i++)
    {
        adj[U[i]].pb({V[i],W[i]});
        adj[V[i]].pb({U[i],W[i]});
    }
    priority_queue<pll> q;
    q.push({0,x});
    q.push({0,y});
    ll ans = 0;
    while(!q.empty())
    {
        auto nod = q.top();
        q.pop();
        if(-nod.F>k)
            break;
        k+=nod.F;
        ans++;
        vis[nod.S]=1;
        for(auto it : adj[nod.S])
        {
            if(vis[it.F])
                continue;
            q.push({nod.F-it.S,it.F});
        }
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 6492 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 59 ms 25124 KB Output is correct
2 Correct 59 ms 25376 KB Output is correct
3 Incorrect 38 ms 20308 KB 2nd lines differ - on the 1st token, expected: '38', found: '1667'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6492 KB Output is correct
2 Incorrect 1 ms 6492 KB 1st lines differ - on the 1st token, expected: '30', found: '18'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6492 KB Output is correct
2 Incorrect 1 ms 6492 KB 1st lines differ - on the 1st token, expected: '30', found: '18'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6492 KB Output is correct
2 Incorrect 1 ms 6492 KB 1st lines differ - on the 1st token, expected: '30', found: '18'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 6492 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 2 ms 6492 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 2 ms 6492 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 2 ms 6492 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 2 ms 6492 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -