結果

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

ソースコード

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();
	if(t[b.second.first]==1){
		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