結果

問題 No.1013 〇マス進む
ユーザー takakintakakin
提出日時 2020-03-23 00:07:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 660 bytes
コンパイル時間 693 ms
コンパイル使用メモリ 11,036 KB
実行使用メモリ 145,568 KB
最終ジャッジ日時 2023-08-27 01:16:57
合計ジャッジ時間 67,276 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,964 KB
testcase_01 AC 16 ms
7,988 KB
testcase_02 AC 16 ms
7,772 KB
testcase_03 AC 26 ms
8,696 KB
testcase_04 AC 19 ms
8,308 KB
testcase_05 AC 26 ms
8,740 KB
testcase_06 AC 25 ms
8,668 KB
testcase_07 AC 33 ms
9,112 KB
testcase_08 AC 27 ms
8,860 KB
testcase_09 AC 36 ms
9,356 KB
testcase_10 AC 31 ms
9,012 KB
testcase_11 AC 25 ms
8,608 KB
testcase_12 AC 35 ms
9,424 KB
testcase_13 AC 101 ms
12,876 KB
testcase_14 AC 1,140 ms
69,708 KB
testcase_15 TLE -
testcase_16 AC 1,791 ms
100,344 KB
testcase_17 AC 1,009 ms
60,636 KB
testcase_18 AC 1,318 ms
74,440 KB
testcase_19 AC 729 ms
46,516 KB
testcase_20 TLE -
testcase_21 AC 917 ms
58,088 KB
testcase_22 AC 1,554 ms
75,792 KB
testcase_23 AC 405 ms
29,340 KB
testcase_24 TLE -
testcase_25 TLE -
testcase_26 AC 454 ms
30,808 KB
testcase_27 AC 867 ms
53,852 KB
testcase_28 AC 405 ms
30,000 KB
testcase_29 TLE -
testcase_30 AC 836 ms
50,420 KB
testcase_31 AC 1,535 ms
87,896 KB
testcase_32 AC 1,108 ms
67,192 KB
testcase_33 AC 1,295 ms
68,484 KB
testcase_34 TLE -
testcase_35 TLE -
testcase_36 AC 151 ms
14,800 KB
testcase_37 AC 143 ms
14,184 KB
testcase_38 TLE -
testcase_39 AC 806 ms
42,044 KB
testcase_40 TLE -
testcase_41 AC 548 ms
31,248 KB
testcase_42 AC 1,281 ms
65,236 KB
testcase_43 AC 827 ms
45,340 KB
testcase_44 AC 1,331 ms
68,520 KB
testcase_45 AC 1,201 ms
61,564 KB
testcase_46 AC 583 ms
33,440 KB
testcase_47 AC 1,221 ms
65,288 KB
testcase_48 AC 1,430 ms
75,732 KB
testcase_49 TLE -
testcase_50 AC 1,819 ms
88,120 KB
testcase_51 AC 1,579 ms
80,312 KB
testcase_52 AC 327 ms
22,500 KB
testcase_53 AC 479 ms
29,068 KB
testcase_54 AC 1,999 ms
98,772 KB
testcase_55 AC 649 ms
34,848 KB
testcase_56 TLE -
testcase_57 AC 1,842 ms
85,776 KB
testcase_58 TLE -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
testcase_62 -- -
testcase_63 -- -
testcase_64 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n,k=map(int,input().split())
P=[int(i) for i in input().split()]
A=[[0]*n for i in range(31)]
B=[[0]*n for i in range(31)]
A[0]=P
for i in range(n):
  A[1][i]=(A[0][i]+i+1)%n
  if A[0][i]+i+1>n:
    B[1][i]=1
  if A[1][i]==0:
    A[1][i]=n
for i in range(1,30):
  for j in range(n):
    A[i+1][j]=A[i][A[i][j]-1]
    B[i+1][j]=B[i][j]+B[i][A[i][j]-1]
Ans1=[int(i)+1 for i in range(n)]
Ans2=[0]*n
for i in range(30):
  if k&(1<<i):
    for j in range(n):
      Ans2[j]+=B[i+1][Ans1[j]-1]
      Ans1[j]=A[i+1][Ans1[j]-1]
      
Ans=[]
for i in range(n):
  Ans.append(Ans1[i]+Ans2[i]*n)
print(*Ans,sep="\n")
0