結果

問題 No.2431 Viral Hotel
ユーザー tailstails
提出日時 2023-08-18 23:05:35
言語 cLay
(20240104-1)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 567 bytes
コンパイル時間 3,333 ms
コンパイル使用メモリ 171,104 KB
実行使用メモリ 17,184 KB
最終ジャッジ日時 2023-08-18 23:05:44
合計ジャッジ時間 7,582 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
12,748 KB
testcase_01 AC 58 ms
12,524 KB
testcase_02 AC 66 ms
12,920 KB
testcase_03 AC 73 ms
11,840 KB
testcase_04 AC 68 ms
11,812 KB
testcase_05 AC 83 ms
14,608 KB
testcase_06 AC 45 ms
13,032 KB
testcase_07 AC 46 ms
12,196 KB
testcase_08 AC 45 ms
11,788 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 77 ms
17,184 KB
testcase_13 AC 69 ms
11,784 KB
testcase_14 AC 26 ms
9,712 KB
testcase_15 AC 16 ms
5,892 KB
testcase_16 AC 19 ms
10,532 KB
testcase_17 AC 27 ms
7,620 KB
testcase_18 AC 61 ms
15,920 KB
testcase_19 AC 28 ms
10,720 KB
testcase_20 AC 15 ms
8,444 KB
testcase_21 AC 15 ms
6,276 KB
testcase_22 AC 48 ms
11,960 KB
testcase_23 AC 51 ms
10,864 KB
testcase_24 AC 18 ms
9,088 KB
testcase_25 AC 58 ms
11,596 KB
testcase_26 AC 27 ms
10,116 KB
testcase_27 AC 39 ms
10,532 KB
testcase_28 AC 32 ms
10,116 KB
testcase_29 AC 37 ms
9,960 KB
testcase_30 AC 46 ms
11,724 KB
testcase_31 AC 45 ms
11,232 KB
testcase_32 AC 19 ms
6,340 KB
testcase_33 AC 37 ms
9,968 KB
testcase_34 AC 3 ms
4,380 KB
testcase_35 AC 9 ms
4,856 KB
testcase_36 AC 43 ms
12,744 KB
testcase_37 AC 35 ms
11,824 KB
testcase_38 AC 13 ms
8,580 KB
testcase_39 AC 1 ms
4,376 KB
testcase_40 AC 1 ms
4,380 KB
testcase_41 AC 2 ms
4,376 KB
testcase_42 AC 2 ms
4,380 KB
testcase_43 AC 72 ms
16,888 KB
testcase_44 AC 43 ms
12,864 KB
testcase_45 AC 32 ms
9,512 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