結果

問題 No.2431 Viral Hotel
ユーザー tails
提出日時 2023-08-18 22:56:21
言語 cLay
(20241019-1)
結果
WA  
実行時間 -
コード長 557 bytes
コンパイル時間 4,627 ms
コンパイル使用メモリ 184,176 KB
実行使用メモリ 21,052 KB
最終ジャッジ日時 2024-11-28 09:20:40
合計ジャッジ時間 8,055 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 6 WA * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

priority_queue<pair<ll,pair<ll,ll>>>q;
ll@n,@k,@m,@p;
int u[m],v[];
rd((u--,v--)(m));
graph g;
g.setEdge(n,m,u,v);
ll@s[n],r[n]{},t[n]{};
rep(k){
	ll@x--;
	t[x]=1;
	rep(j,g.es[x]){
		ll a=g.edge[x][j];
		q.push({-s[x],{x,a}});
	}
}
while(!q.empty()){
	auto b=q.top();
	q.pop();
	ll f=b.second.first;
	if(t[f]==1||r[f]==-b.first-p){
		ll x=b.second.second;
		if(!t[x]){
			t[x]=1;
			r[x]=-b.first;
			rep(j,g.es[x]){
				ll a=g.edge[x][j];
				q.push({b.first-s[x],{x,a}});
			}
		}else if(r[x]>-b.first-p){
			t[x]=2;
		}
	}
}
wt(sum[ll][i,0,n](t[i]==2));
0