結果

問題 No.2431 Viral Hotel
ユーザー tailstails
提出日時 2023-08-18 23:05:35
言語 cLay
(20240104-1)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 567 bytes
コンパイル時間 4,390 ms
コンパイル使用メモリ 181,764 KB
実行使用メモリ 16,312 KB
最終ジャッジ日時 2024-05-06 05:37:15
合計ジャッジ時間 5,919 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
12,120 KB
testcase_01 AC 50 ms
11,596 KB
testcase_02 AC 58 ms
11,988 KB
testcase_03 AC 54 ms
11,804 KB
testcase_04 AC 55 ms
11,932 KB
testcase_05 AC 65 ms
13,340 KB
testcase_06 AC 41 ms
11,864 KB
testcase_07 AC 45 ms
11,740 KB
testcase_08 AC 42 ms
11,868 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 73 ms
16,312 KB
testcase_13 AC 58 ms
11,696 KB
testcase_14 AC 22 ms
7,936 KB
testcase_15 AC 15 ms
6,136 KB
testcase_16 AC 17 ms
9,120 KB
testcase_17 AC 24 ms
7,772 KB
testcase_18 AC 55 ms
15,128 KB
testcase_19 AC 25 ms
9,416 KB
testcase_20 AC 13 ms
6,656 KB
testcase_21 AC 15 ms
6,552 KB
testcase_22 AC 41 ms
10,520 KB
testcase_23 AC 44 ms
9,580 KB
testcase_24 AC 15 ms
7,552 KB
testcase_25 AC 48 ms
11,044 KB
testcase_26 AC 23 ms
8,704 KB
testcase_27 AC 34 ms
9,420 KB
testcase_28 AC 27 ms
8,504 KB
testcase_29 AC 32 ms
8,348 KB
testcase_30 AC 40 ms
10,244 KB
testcase_31 AC 37 ms
10,476 KB
testcase_32 AC 18 ms
6,536 KB
testcase_33 AC 31 ms
8,212 KB
testcase_34 AC 3 ms
5,376 KB
testcase_35 AC 9 ms
5,376 KB
testcase_36 AC 40 ms
11,916 KB
testcase_37 AC 32 ms
10,168 KB
testcase_38 AC 11 ms
7,040 KB
testcase_39 AC 1 ms
5,376 KB
testcase_40 AC 2 ms
5,376 KB
testcase_41 AC 2 ms
5,376 KB
testcase_42 AC 2 ms
5,376 KB
testcase_43 AC 59 ms
15,924 KB
testcase_44 AC 38 ms
10,976 KB
testcase_45 AC 27 ms
7,808 KB
権限があれば一括ダウンロードができます

ソースコード

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 d=-b.first;
	ll f=b.second.first;
	if(t[f]!=2||r[f]==d){
		ll x=b.second.second;
		if(!t[x]){
			t[x]=1;
			r[x]=d;
			rep(j,g.es[x]){
				ll a=g.edge[x][j];
				q.push({-(d+s[x]),{x,a}});
			}
		}else if(t[x]==1&&d-r[x]<p){
			t[x]=2;
			r[x]=d;
		}
	}
}
wt(sum[ll][i,0,n](t[i]==2));
0