結果

問題 No.2242 Cities and Teleporters
ユーザー tailstails
提出日時 2023-03-10 22:42:52
言語 cLay
(20240104-1)
結果
AC  
実行時間 446 ms / 3,000 ms
コード長 391 bytes
コンパイル時間 8,690 ms
コンパイル使用メモリ 219,860 KB
実行使用メモリ 85,196 KB
最終ジャッジ日時 2023-10-18 08:23:05
合計ジャッジ時間 17,497 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
70,244 KB
testcase_01 AC 66 ms
70,244 KB
testcase_02 AC 66 ms
70,244 KB
testcase_03 AC 66 ms
70,244 KB
testcase_04 AC 66 ms
70,244 KB
testcase_05 AC 283 ms
85,196 KB
testcase_06 AC 280 ms
85,196 KB
testcase_07 AC 282 ms
85,196 KB
testcase_08 AC 446 ms
85,196 KB
testcase_09 AC 289 ms
85,196 KB
testcase_10 AC 109 ms
85,196 KB
testcase_11 AC 172 ms
84,980 KB
testcase_12 AC 174 ms
84,980 KB
testcase_13 AC 199 ms
85,160 KB
testcase_14 AC 243 ms
85,196 KB
testcase_15 AC 193 ms
85,160 KB
testcase_16 AC 272 ms
85,196 KB
testcase_17 AC 386 ms
85,196 KB
testcase_18 AC 190 ms
85,032 KB
testcase_19 AC 358 ms
85,012 KB
testcase_20 AC 191 ms
85,008 KB
testcase_21 AC 179 ms
84,940 KB
testcase_22 AC 353 ms
84,932 KB
testcase_23 AC 370 ms
85,080 KB
testcase_24 AC 365 ms
85,080 KB
testcase_25 AC 374 ms
85,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ll@n,@h[n],@t[],e[20][4d5]{},@q;
coordcomp(n,h,n,t);
rep(i,4d5){
	e[0][i]=i;
}
rep(i,n){
	e[0][h[i]]>?=t[i];
}
rep(i,1,4d5){
	e[0][i]>?=e[0][i-1];
}
rep(k,1,20){
	rep(i,4d5){
		e[k][i]=e[k-1][e[k-1][i]];
	}
}
rep(q){
	ll@a--,@b--;
	if(t[a]>=h[b]){
		wt(1);
	}else{
		int c=t[a];
		int z=0;
		rrep(k,20){
			if(e[k][c]<h[b]){
				z+=1<<k;
				c=e[k][c];
			}
		}
		wt(z<1048575?z+2:-1);
	}
}
0