답안 #1006827

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1006827 2024-06-24T09:11:00 Z Haidara314 봉쇄 시간 (IOI23_closing) C++17
8 / 100
90 ms 21100 KB
#include "closing.h"

#include <bits/stdc++.h>
#define S second
#define F first
using namespace std;
vector<pair<int,long long>>adj[200005];
bool vis[200005];
int dis[200005];
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++){adj[i].clear();vis[i]=0;dis[i]=0;}
    for(int i=0;i<N-1;i++)
    {
        adj[U[i]].push_back({V[i],W[i]});
        adj[V[i]].push_back({U[i],W[i]});
    }
    int ans=0;
    int f=0;
    priority_queue<pair<int,int>>pq;
    pq.push({0,X});
    pq.push({0,Y});
    while(!pq.empty())
    {
        int c=(pq.top()).S;
        long long y=-((pq.top()).F);
        pq.pop();
        if(vis[c])continue;
        vis[c]=1;
        if(y<=K)
        {
            K-=y;
            ans++;
        for(auto j:adj[c])
        {
            pq.push({-(j.S+y),j.F});
        }
        }
    }
    return ans;
}
/*
1
7 0 2 10
 0 0 1 2 2 5
 1 3 2 4 5 6
 2 3 4 2 5 3
*/
/*
1
4 0 3 20
0 1 2
1 2 3
18 1 19
*/

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:20:9: warning: unused variable 'f' [-Wunused-variable]
   20 |     int f=0;
      |         ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 5976 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 90 ms 21100 KB Output is correct
2 Correct 57 ms 21096 KB Output is correct
3 Correct 32 ms 8284 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 5724 KB Output is correct
2 Incorrect 1 ms 5724 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 5724 KB Output is correct
2 Incorrect 1 ms 5724 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 5724 KB Output is correct
2 Incorrect 1 ms 5724 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 5976 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 5976 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 5976 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 5976 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 5976 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -