結果

問題 No.1013 〇マス進む
ユーザー 37zigen37zigen
提出日時 2019-12-07 22:09:21
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,056 ms / 2,000 ms
コード長 816 bytes
コンパイル時間 2,616 ms
コンパイル使用メモリ 74,152 KB
実行使用メモリ 149,156 KB
最終ジャッジ日時 2023-08-27 04:11:43
合計ジャッジ時間 45,310 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
55,716 KB
testcase_01 AC 130 ms
55,660 KB
testcase_02 AC 132 ms
55,896 KB
testcase_03 AC 173 ms
56,032 KB
testcase_04 AC 152 ms
55,604 KB
testcase_05 AC 191 ms
56,012 KB
testcase_06 AC 166 ms
55,848 KB
testcase_07 AC 197 ms
56,556 KB
testcase_08 AC 184 ms
55,692 KB
testcase_09 AC 211 ms
59,100 KB
testcase_10 AC 206 ms
56,376 KB
testcase_11 AC 174 ms
55,932 KB
testcase_12 AC 214 ms
58,492 KB
testcase_13 AC 263 ms
61,820 KB
testcase_14 AC 628 ms
99,624 KB
testcase_15 AC 868 ms
120,768 KB
testcase_16 AC 770 ms
115,252 KB
testcase_17 AC 595 ms
93,544 KB
testcase_18 AC 691 ms
103,132 KB
testcase_19 AC 539 ms
81,440 KB
testcase_20 AC 913 ms
141,728 KB
testcase_21 AC 577 ms
92,392 KB
testcase_22 AC 700 ms
104,912 KB
testcase_23 AC 398 ms
71,840 KB
testcase_24 AC 961 ms
145,696 KB
testcase_25 AC 954 ms
144,968 KB
testcase_26 AC 382 ms
72,076 KB
testcase_27 AC 554 ms
89,212 KB
testcase_28 AC 386 ms
71,600 KB
testcase_29 AC 924 ms
141,492 KB
testcase_30 AC 558 ms
81,888 KB
testcase_31 AC 720 ms
108,896 KB
testcase_32 AC 609 ms
98,036 KB
testcase_33 AC 645 ms
98,944 KB
testcase_34 AC 869 ms
117,780 KB
testcase_35 AC 881 ms
115,940 KB
testcase_36 AC 266 ms
62,040 KB
testcase_37 AC 272 ms
62,448 KB
testcase_38 AC 910 ms
130,548 KB
testcase_39 AC 497 ms
77,968 KB
testcase_40 AC 920 ms
115,780 KB
testcase_41 AC 441 ms
70,980 KB
testcase_42 AC 657 ms
97,996 KB
testcase_43 AC 490 ms
79,764 KB
testcase_44 AC 652 ms
99,340 KB
testcase_45 AC 624 ms
91,896 KB
testcase_46 AC 429 ms
72,752 KB
testcase_47 AC 642 ms
97,392 KB
testcase_48 AC 684 ms
103,708 KB
testcase_49 AC 910 ms
115,904 KB
testcase_50 AC 765 ms
109,976 KB
testcase_51 AC 723 ms
106,572 KB
testcase_52 AC 337 ms
64,756 KB
testcase_53 AC 381 ms
67,152 KB
testcase_54 AC 786 ms
113,388 KB
testcase_55 AC 449 ms
73,496 KB
testcase_56 AC 998 ms
136,420 KB
testcase_57 AC 812 ms
109,572 KB
testcase_58 AC 1,056 ms
147,648 KB
testcase_59 AC 1,006 ms
146,820 KB
testcase_60 AC 935 ms
149,156 KB
testcase_61 AC 918 ms
146,884 KB
testcase_62 AC 912 ms
146,904 KB
testcase_63 AC 128 ms
54,312 KB
testcase_64 AC 126 ms
55,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.math.*;
import java.io.*;

class Main
{
	public static void main(String[] args)
	{
		new Main().run();
	}
	
	void run(){
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		long K=sc.nextLong();
		int[] P=new int[N];
		long[][] add=new long[63][N];
		for(int i=0;i<N;++i){
			P[i]=sc.nextInt();
			add[0][i]=P[i];
		}
		for(int i=0;i+1<30;++i){
			for(int j=0;j<N;++j){
				add[i+1][j]=add[i][j]+add[i][(int)((j+add[i][j])%N)];
			}
		}
		PrintWriter pw=new PrintWriter(System.out);
		for(int i=0;i<N;++i){
			long res=K;
			long cur=i;
			for(int shift=0;shift<30;++shift){
				if((res>>shift)%2==1)
					cur=cur+add[shift][(int)(cur%N)];
			}
			pw.println(cur+1);
		}
		pw.close();
	}
	
	void tr(Object...objects){
		System.out.println(Arrays.deepToString(objects));
	}
}
0