답안 #1068133

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1068133 2024-08-21T07:55:52 Z jamjanek 봉쇄 시간 (IOI23_closing) C++17
8 / 100
68 ms 25684 KB
#include "closing.h"
#include <bits/stdc++.h>
using namespace std;

bool odw[200010];
long long dist[200010];
vector<pair<int,long long>>graf[200010];
int max_score(int n, int x, int y, long long k,vector<int> U, vector<int> V, vector<int> W)
{
	int i;
	priority_queue<pair<long long,int>>kolejka;
	for(i=0;i<n;i++){
		odw[i] = dist[i]=0;
		graf[i].clear();
	}
	for(i=0;i<n-1;i++){
		graf[U[i]].push_back({V[i], W[i]});
		graf[V[i]].push_back({U[i], W[i]});
	}
	kolejka.push({0,x});
	kolejka.push({0,y});
	int wynik = 0;
	while(kolejka.size()){
		auto a = kolejka.top();
		kolejka.pop();
		if(odw[a.second])continue;
		if(-a.first>k)break;
		odw[a.second]=1;
		k+=a.first;
		wynik++;
		for(auto j: graf[a.second])
			if(odw[j.first]==0)
				kolejka.push({a.first-j.second, j.first});
	}
	return wynik;
}

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:13:19: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   13 |   odw[i] = dist[i]=0;
      |            ~~~~~~~^~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4952 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 68 ms 25428 KB Output is correct
2 Correct 67 ms 25684 KB Output is correct
3 Correct 37 ms 10064 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4952 KB Output is correct
2 Incorrect 2 ms 4956 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4952 KB Output is correct
2 Incorrect 2 ms 4956 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4952 KB Output is correct
2 Incorrect 2 ms 4956 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4952 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4952 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4952 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4952 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4952 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -