# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
844666 | oneloveforever | 봉쇄 시간 (IOI23_closing) | C++17 | 84 ms | 20584 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "closing.h"
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define ii pair<int,int>
int n,a,b,k;
vector<vector<ii> >edge;
int Sub1()
{
queue<int>q;
vector<vector<int> >dist(2,vector<int>(n+1,-1));
vector<int>source(2);
source[0]=a;
source[1]=b;
for(int i=0;i<=1;i++)
{
queue<int>q;
q.push(source[i]);
dist[i][source[i]]=0;
while(!q.empty())
{
int x=q.front();
q.pop();
for(ii need:edge[x])
{
int node=need.x;
int value=need.y;
if(dist[i][node]==-1)
{
dist[i][node]=dist[i][x]+value;
q.push(node);
}
}
}
}
if(dist[0][source[1]]<2*k)return -1;
priority_queue<int,vector<int>,greater<int> >p;
for(int i=1;i<=n;i++)
{
if(dist[0][i]<=k)p.push(dist[0][i]);
if(dist[1][i]<=k)p.push(dist[1][i]);
}
int res=k;
int ans=0;
while(!p.empty())
{
int x=p.top();
p.pop();
if(res<x)break;
res-=x;
ans++;
}
return ans;
}
int max_score(int N,int X,int Y,long long K,vector<int>U,vector<int>V,vector<int>W)
{
n=N;
a=X+1;
b=Y+1;
k=K;
edge.resize(n+1);
for(int i=1;i<=N-1;i++)
{
int x=U[i-1]+1;
int y=V[i-1]+1;
int value=W[i-1];
edge[x].push_back({y,value});
edge[y].push_back({x,value});
}
int value=Sub1();
if(value!=-1)return value;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |