Submission #1017143

# Submission time Handle Problem Language Result Execution time Memory
1017143 2024-07-08T22:57:04 Z SiliconSquared Closing Time (IOI23_closing) C++17
8 / 100
55 ms 20564 KB
using namespace std;
#include "closing.h"
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#define ll long long
#define ld long double
#define INF 1000000000000000000

struct city{
    vector<pair<int,int>> v;
    city(){}
};
vector<city> v;
int max_score(int n,int x,int y,ll k,vector<int> U,vector<int> V, vector<int> W){
    v.clear();
    v.resize(n);
    for (int i=0;i<n-1;i++){
        v[U[i]].v.push_back({V[i],W[i]});
        v[V[i]].v.push_back({U[i],W[i]});
    }
    int z=0;
    priority_queue<pair<ll,int>,vector<pair<ll,int>>,greater<pair<ll,int>>> q;
    q.push({0,x});
    q.push({0,y});
    pair<ll,int> p;
    set<int> s;
    while (!q.empty()&&q.top().first<=k){
        p=q.top();
        q.pop();
        if (s.find(p.second)!=s.end()){continue;}
        s.insert(p.second);
        k-=p.first;
        z++;
        for (auto i:v[p.second].v){
            q.push({p.first+i.second,i.first});
        }
    }
    return z;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 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 55 ms 20564 KB Output is correct
2 Correct 55 ms 20312 KB Output is correct
3 Correct 41 ms 5204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 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 0 ms 344 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 0 ms 344 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 0 ms 344 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 0 ms 344 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -