# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
980182 | 2024-05-12T00:42:19 Z | FZ_Melo | Closing Time (IOI23_closing) | C++17 | 169 ms | 34388 KB |
#include "closing.h" #include <bits/stdc++.h> #include <vector> #include <queue> using namespace std; struct ari{ int node; long long w; }; struct tpos{ int node; long long cnt; bool x; }; bool operator <(const tpos &a, const tpos &b){ return a.cnt>b.cnt; } int n; long long k; long long cnt; int ans; vector<vector<ari>> adj; priority_queue<tpos> q; void dfs(){ tpos t, ta; while(!q.empty() && cnt<k){ t=q.top(); q.pop(); if(cnt+t.cnt<=k) cnt+=t.cnt; else break; ans++; for(auto h: adj[t.node]){ q.push({h.node, t.cnt+h.w}); } } while(!q.empty()) q.pop(); } 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; k=K; ans=0; cnt=2; adj.clear(); adj.resize(n); for(int i=0; i<n-1; i++){ adj[U[i]].push_back({V[i], W[i]}); adj[V[i]].push_back({U[i], W[i]}); } for(int i=0; i<adj[X].size(); i++){ q.push({adj[X][i].node, adj[X][i].w}); } for(int i=0; i<adj[Y].size(); i++){ q.push({adj[Y][i].node, adj[Y][i].w}); } dfs(); return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | 1st lines differ - on the 1st token, expected: '6', found: '3' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 169 ms | 34388 KB | 1st lines differ - on the 1st token, expected: '451', found: '481379' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | 1st lines differ - on the 1st token, expected: '3', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | 1st lines differ - on the 1st token, expected: '3', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | 1st lines differ - on the 1st token, expected: '3', found: '0' |
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: '3' |
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: '3' |
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: '3' |
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: '3' |
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: '3' |
2 | Halted | 0 ms | 0 KB | - |