結果

問題 No.1013 〇マス進む
ユーザー 37zigen37zigen
提出日時 2019-12-07 22:33:55
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,028 ms / 2,000 ms
コード長 1,055 bytes
コンパイル時間 3,782 ms
コンパイル使用メモリ 74,420 KB
実行使用メモリ 147,380 KB
最終ジャッジ日時 2023-08-27 04:51:39
合計ジャッジ時間 42,197 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,820 KB
testcase_01 AC 124 ms
55,976 KB
testcase_02 AC 125 ms
55,816 KB
testcase_03 AC 183 ms
56,044 KB
testcase_04 AC 144 ms
55,816 KB
testcase_05 AC 181 ms
56,300 KB
testcase_06 AC 169 ms
53,868 KB
testcase_07 AC 202 ms
56,300 KB
testcase_08 AC 172 ms
56,864 KB
testcase_09 AC 202 ms
59,084 KB
testcase_10 AC 197 ms
57,176 KB
testcase_11 AC 159 ms
55,952 KB
testcase_12 AC 205 ms
58,872 KB
testcase_13 AC 250 ms
59,860 KB
testcase_14 AC 636 ms
99,588 KB
testcase_15 AC 848 ms
118,664 KB
testcase_16 AC 769 ms
115,336 KB
testcase_17 AC 585 ms
94,012 KB
testcase_18 AC 644 ms
102,824 KB
testcase_19 AC 513 ms
81,232 KB
testcase_20 AC 883 ms
142,172 KB
testcase_21 AC 577 ms
92,072 KB
testcase_22 AC 688 ms
105,412 KB
testcase_23 AC 382 ms
72,256 KB
testcase_24 AC 940 ms
145,736 KB
testcase_25 AC 900 ms
144,676 KB
testcase_26 AC 370 ms
72,020 KB
testcase_27 AC 541 ms
89,048 KB
testcase_28 AC 374 ms
71,792 KB
testcase_29 AC 894 ms
141,584 KB
testcase_30 AC 537 ms
82,120 KB
testcase_31 AC 717 ms
109,124 KB
testcase_32 AC 610 ms
98,132 KB
testcase_33 AC 634 ms
98,876 KB
testcase_34 AC 857 ms
117,980 KB
testcase_35 AC 846 ms
115,920 KB
testcase_36 AC 263 ms
61,920 KB
testcase_37 AC 260 ms
62,068 KB
testcase_38 AC 905 ms
131,620 KB
testcase_39 AC 483 ms
77,864 KB
testcase_40 AC 875 ms
115,876 KB
testcase_41 AC 396 ms
70,892 KB
testcase_42 AC 632 ms
97,540 KB
testcase_43 AC 474 ms
79,996 KB
testcase_44 AC 637 ms
101,096 KB
testcase_45 AC 594 ms
92,100 KB
testcase_46 AC 405 ms
72,744 KB
testcase_47 AC 632 ms
97,628 KB
testcase_48 AC 657 ms
103,548 KB
testcase_49 AC 876 ms
115,792 KB
testcase_50 AC 747 ms
110,064 KB
testcase_51 AC 716 ms
106,264 KB
testcase_52 AC 337 ms
65,020 KB
testcase_53 AC 372 ms
66,932 KB
testcase_54 AC 771 ms
113,628 KB
testcase_55 AC 457 ms
72,212 KB
testcase_56 AC 948 ms
136,676 KB
testcase_57 AC 797 ms
111,532 KB
testcase_58 AC 1,028 ms
147,336 KB
testcase_59 AC 1,010 ms
147,144 KB
testcase_60 AC 910 ms
146,964 KB
testcase_61 AC 902 ms
146,900 KB
testcase_62 AC 875 ms
147,380 KB
testcase_63 AC 128 ms
55,792 KB
testcase_64 AC 124 ms
55,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//制約侵害のcheck

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();
		if(!(1<=N&&N<=1e5&&1<=K&&K<=1e9))throw new AssertionError();
		int[] P=new int[N];
		long[][] add=new long[63][N];
		boolean[] vis=new boolean[N];
		for(int i=0;i<N;++i){
			P[i]=sc.nextInt();
			add[0][i]=P[i];
			vis[P[i]-1]=true;
		}
		boolean check=true;
		for(int i=0;i<N;++i)check&=vis[i];
		if(!check)throw new AssertionError();
		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