# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1065172 | 2024-08-19T02:29:52 Z | pcc | Closing Time (IOI23_closing) | C++17 | 107 ms | 37152 KB |
#include "closing.h" #include <vector> #include <bits/stdc++.h> using namespace std; #define pll pair<ll,ll> #define pii pair<int,int> #define fs first #define sc second #define ll long long const int mxn = 2e5+10; vector<pii> tree[mxn]; ll dp[mxn]; int N; void init(){ for(int i = 0;i<=N;i++)tree[i].clear(); } void dfs(int now,int par){ if(now == par)dp[now] = 0; for(auto [nxt,w]:tree[now]){ if(nxt == par)continue; dp[nxt] = dp[now]+w; dfs(nxt,now); } return; } int max_score(int NN, int X, int Y, long long K, std::vector<int> U, std::vector<int> V, std::vector<int> W){ init(); N = NN; for(int i = 0;i<U.size();i++){ int a = U[i],b = V[i],w = W[i]; tree[a].push_back(pii(b,w)); tree[b].push_back(pii(a,w)); } vector<pll> v; dfs(X,X); for(int i = 0;i<N;i++)v.push_back(pll(dp[i],i)); dfs(Y,Y); for(int i = 0;i<N;i++)v.push_back(pll(dp[i],i)); sort(v.begin(),v.end()); ll sum = 0; int ans = 0; for(auto &i:v){ if(sum+i.fs<=K){ ans++; sum += i.fs; } } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 6488 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 | 105 ms | 32704 KB | Output is correct |
2 | Correct | 107 ms | 37152 KB | Output is correct |
3 | Correct | 57 ms | 8896 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 6492 KB | Output is correct |
2 | Incorrect | 1 ms | 6492 KB | 1st lines differ - on the 1st token, expected: '30', found: '24' |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 6492 KB | Output is correct |
2 | Incorrect | 1 ms | 6492 KB | 1st lines differ - on the 1st token, expected: '30', found: '24' |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 6492 KB | Output is correct |
2 | Incorrect | 1 ms | 6492 KB | 1st lines differ - on the 1st token, expected: '30', found: '24' |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 6488 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 | 6488 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 | 6488 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 | 6488 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 | 6488 KB | 1st lines differ - on the 1st token, expected: '6', found: '5' |
2 | Halted | 0 ms | 0 KB | - |