# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1069522 | 2024-08-22T04:55:28 Z | Faisal_Saqib | Closing Time (IOI23_closing) | C++17 | 63 ms | 24196 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #define pll pair<ll,ll> #define ppll pair<ll,pll> #define vpl vector<pll> const int N=2e5+10; vpl ma[N]; ll paid[N]; bool vis[N][2]; int max_score(int n, int x, int y, long long k, std::vector<int> U,std::vector<int> V, std::vector<int> W) { for(int i=0;i<=n;i++) { ma[i].clear(); paid[i]=0; vis[i][0]=vis[i][1]=0; } int m=U.size(); for(int i=0;i<m;i++) { ma[U[i]].push_back({W[i],V[i]}); ma[V[i]].push_back({W[i],U[i]}); } priority_queue<ppll,vector<ppll>,greater<ppll>> pq; pq.push({0,{0,x}}); pq.push({0,{1,y}}); ll cur=0; ll tlp=0; int total=0; while(pq.size()>0) { ppll it=pq.top(); pq.pop(); int u=it.second.second; ll c=it.first; int origin=it.second.first; if(vis[u][origin])continue; c-=paid[u]; c=max(0ll,c); if((cur+c)>k) break; vis[u][origin]=1; cur+=c; paid[u]+=c; total++; for(auto [w,v]:ma[u]) pq.push({c+w,{origin,v}}); } return total; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 6744 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 62 ms | 22084 KB | Output is correct |
2 | Correct | 63 ms | 24196 KB | Output is correct |
3 | Correct | 38 ms | 10872 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 6744 KB | Output is correct |
2 | Incorrect | 1 ms | 6748 KB | 1st lines differ - on the 1st token, expected: '30', found: '40' |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 6744 KB | Output is correct |
2 | Incorrect | 1 ms | 6748 KB | 1st lines differ - on the 1st token, expected: '30', found: '40' |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 6744 KB | Output is correct |
2 | Incorrect | 1 ms | 6748 KB | 1st lines differ - on the 1st token, expected: '30', found: '40' |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 6744 KB | Output is correct |
2 | Correct | 1 ms | 6744 KB | Output is correct |
3 | Incorrect | 1 ms | 6748 KB | 1st lines differ - on the 1st token, expected: '30', found: '40' |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 6744 KB | Output is correct |
2 | Correct | 1 ms | 6744 KB | Output is correct |
3 | Incorrect | 1 ms | 6748 KB | 1st lines differ - on the 1st token, expected: '30', found: '40' |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 6744 KB | Output is correct |
2 | Correct | 1 ms | 6744 KB | Output is correct |
3 | Incorrect | 1 ms | 6748 KB | 1st lines differ - on the 1st token, expected: '30', found: '40' |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 6744 KB | Output is correct |
2 | Correct | 1 ms | 6744 KB | Output is correct |
3 | Incorrect | 1 ms | 6748 KB | 1st lines differ - on the 1st token, expected: '30', found: '40' |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 6744 KB | Output is correct |
2 | Correct | 1 ms | 6744 KB | Output is correct |
3 | Incorrect | 1 ms | 6748 KB | 1st lines differ - on the 1st token, expected: '30', found: '40' |
4 | Halted | 0 ms | 0 KB | - |