답안 #1069515

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1069515 2024-08-22T04:46:06 Z Faisal_Saqib 봉쇄 시간 (IOI23_closing) C++17
0 / 100
119 ms 34336 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define vpl vector<pll>
const int N=2e5+10;
vpl ma[N];
ll paid[N];
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;
    }
    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]});
    }
    int mx=0;
    {
        priority_queue<pll,vpl,greater<pll>> pq;
        pq.push({0,x});
        ll cur=0;
        ll tlp=0;
        int total=0;
        while(pq.size()>0)
        {
            pll it=pq.top();
            pq.pop();
            int u=it.second;
            ll c=it.first;
            if((cur+c)>k)
                break;
            cur+=c;
            paid[u]+=c;
            total++;
            for(auto [w,v]:ma[u])
            {
                pq.push({c+w,v});
            }
        }
        mx=max(mx,total);
    }
    {
        priority_queue<pll,vpl,greater<pll>> pq;
        pq.push({0,y});
        ll cur=0;
        ll tlp=0;
        int total=0;
        while(pq.size()>0)
        {
            pll it=pq.top();
            pq.pop();
            int u=it.second;
            ll c=it.first;
            if((cur+c)>k)
                break;
            cur+=c;
            paid[u]+=c;
            total++;
            for(auto [w,v]:ma[u])
            {
                pq.push({c+w,v});
            }
        }
        mx=max(mx,total);
    }
    return mx;
}

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:27:12: warning: unused variable 'tlp' [-Wunused-variable]
   27 |         ll tlp=0;
      |            ^~~
closing.cpp:51:12: warning: unused variable 'tlp' [-Wunused-variable]
   51 |         ll tlp=0;
      |            ^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 6488 KB 1st lines differ - on the 1st token, expected: '6', found: '4'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 119 ms 34336 KB 1st lines differ - on the 1st token, expected: '451', found: '481355'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4956 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4956 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4956 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 6488 KB 1st lines differ - on the 1st token, expected: '6', found: '4'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 6488 KB 1st lines differ - on the 1st token, expected: '6', found: '4'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 6488 KB 1st lines differ - on the 1st token, expected: '6', found: '4'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 6488 KB 1st lines differ - on the 1st token, expected: '6', found: '4'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 6488 KB 1st lines differ - on the 1st token, expected: '6', found: '4'
2 Halted 0 ms 0 KB -