Submission #840913

# Submission time Handle Problem Language Result Execution time Memory
840913 2023-08-31T21:10:09 Z study Closing Time (IOI23_closing) C++17
0 / 100
80 ms 17128 KB
#include "closing.h"

#include <bits/stdc++.h>
using namespace std;

int max_score(int N, int X, int Y, long long K,
              std::vector<int> U, std::vector<int> V, std::vector<int> W)
{
        vector<vector<pair<int,int>>> adj(N);
        for (int i=0; i<N; ++i){
                adj[U[i]].emplace_back(V[i],W[i]);
                adj[V[i]].emplace_back(U[i],W[i]);
        }
        vector<bool> vu(N);
        multiset<pair<int,int>> st;
        st.emplace(0,X);
        st.emplace(0,Y);
        vu[X] = vu[Y] = 1;
        int ans = 0;
        while (!st.empty()){
                auto [w,u] = *st.begin();
                st.erase(st.begin());
                if (K >= w){
                        K -= w;
                        ++ans;
                }
                for (auto [v,w2]:adj[u])
                        if (!vu[v]){
                                vu[v] = true;
                                st.emplace(w2,v);
                        }
        }
        return ans;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 80 ms 17128 KB 1st lines differ - on the 1st token, expected: '451', found: '49379'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -