답안 #1069520

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1069520 2024-08-22T04:54:18 Z Faisal_Saqib 봉쇄 시간 (IOI23_closing) C++17
8 / 100
61 ms 22100 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];
        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

closing.cpp: In function 'int max_score(int, int, int, long long int, std::vector<int>, std::vector<int>, std::vector<int>)':
closing.cpp:29:8: warning: unused variable 'tlp' [-Wunused-variable]
   29 |     ll tlp=0;
      |        ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 61 ms 21992 KB Output is correct
2 Correct 57 ms 22100 KB Output is correct
3 Correct 33 ms 9264 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6748 KB Output is correct
2 Incorrect 1 ms 6748 KB 1st lines differ - on the 1st token, expected: '30', found: '37'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6748 KB Output is correct
2 Incorrect 1 ms 6748 KB 1st lines differ - on the 1st token, expected: '30', found: '37'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6748 KB Output is correct
2 Incorrect 1 ms 6748 KB 1st lines differ - on the 1st token, expected: '30', found: '37'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6748 KB Output is correct
2 Correct 1 ms 6748 KB Output is correct
3 Incorrect 1 ms 6748 KB 1st lines differ - on the 1st token, expected: '30', found: '37'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6748 KB Output is correct
2 Correct 1 ms 6748 KB Output is correct
3 Incorrect 1 ms 6748 KB 1st lines differ - on the 1st token, expected: '30', found: '37'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6748 KB Output is correct
2 Correct 1 ms 6748 KB Output is correct
3 Incorrect 1 ms 6748 KB 1st lines differ - on the 1st token, expected: '30', found: '37'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6748 KB Output is correct
2 Correct 1 ms 6748 KB Output is correct
3 Incorrect 1 ms 6748 KB 1st lines differ - on the 1st token, expected: '30', found: '37'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6748 KB Output is correct
2 Correct 1 ms 6748 KB Output is correct
3 Incorrect 1 ms 6748 KB 1st lines differ - on the 1st token, expected: '30', found: '37'
4 Halted 0 ms 0 KB -