Submission #1069530

# Submission time Handle Problem Language Result Execution time Memory
1069530 2024-08-22T05:05:49 Z Faisal_Saqib Closing Time (IOI23_closing) C++17
0 / 100
69 ms 25196 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],dist[N][2];
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;
        dist[i][0]=dist[i][1]=1e9+10;
    }
    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}});
    dist[x][0]=0;
    dist[y][1]=0;
    ll cur=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(c!=dist[u][origin] or vis[u][origin])continue;

        c-=paid[u];
        c=max(0ll,c);

        if((cur+c)>k)
            continue;
        

        cur+=c;
        paid[u]+=c;
        total++;
        vis[u][origin]=0;
        
        for(auto [w,v]:ma[u])
        {
            if(dist[v][origin]>(c+w))
            {
                dist[v][origin]=c+w;
                pq.push({c+w,{origin,v}});
            }
        }
    }
    return n;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 9816 KB 1st lines differ - on the 1st token, expected: '6', found: '7'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 69 ms 25196 KB 1st lines differ - on the 1st token, expected: '451', found: '200000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 9816 KB Output is correct
2 Incorrect 2 ms 9820 KB 1st lines differ - on the 1st token, expected: '30', found: '20'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 9816 KB Output is correct
2 Incorrect 2 ms 9820 KB 1st lines differ - on the 1st token, expected: '30', found: '20'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 9816 KB Output is correct
2 Incorrect 2 ms 9820 KB 1st lines differ - on the 1st token, expected: '30', found: '20'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 9816 KB 1st lines differ - on the 1st token, expected: '6', found: '7'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 9816 KB 1st lines differ - on the 1st token, expected: '6', found: '7'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 9816 KB 1st lines differ - on the 1st token, expected: '6', found: '7'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 9816 KB 1st lines differ - on the 1st token, expected: '6', found: '7'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 9816 KB 1st lines differ - on the 1st token, expected: '6', found: '7'
2 Halted 0 ms 0 KB -