답안 #980099

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
980099 2024-05-11T23:37:28 Z vjudge1 봉쇄 시간 (IOI23_closing) C++17
8 / 100
80 ms 23892 KB
#include "closing.h"
using namespace std;
#include <bits/stdc++.h>
#define pb push_back

using lli=long long;
#define deb(x) cout<<#x<<": "<<x<<endl;
int  max_score(int N, int X, int Y, long long K,
              vector<int> U, vector<int> V, vector<int> W)
{
    vector<vector<pair<lli,lli>>> adj (N);
    for(lli i=0; i<N-1; ++i){
        adj[U[i]].pb({W[i], V[i]});
        adj[V[i]].pb({W[i], U[i]});
    }
    priority_queue<pair<lli,lli>, vector<pair<lli,lli>>, greater<pair<lli,lli>>> pq;
    pq.push({0, X});
    pq.push({0,Y});
    vector<bool> visited (N, false);
    int ans=0;
    while(!pq.empty()){
        lli a=pq.top().first;
        lli b=pq.top().second;
        pq.pop();
        if(visited[b]) continue;
        if(K<a) break;
        visited[b]=true;
        ans++;
        K-=a;
        for(lli i=0; i<adj[b].size(); ++i){
            if(!visited[adj[b][i].second]){
            pq.push({adj[b][i].first+a, adj[b][i].second});
            }
        }
    }
    return ans;

}

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:30:23: warning: comparison of integer expressions of different signedness: 'lli' {aka 'long long int'} and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |         for(lli i=0; i<adj[b].size(); ++i){
      |                      ~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 73 ms 20048 KB Output is correct
2 Correct 80 ms 23892 KB Output is correct
3 Correct 56 ms 5456 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -