結果

問題 No.1013 〇マス進む
ユーザー たたき@競プロたたき@競プロ
提出日時 2023-10-13 04:11:37
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 863 bytes
コンパイル時間 7,111 ms
コンパイル使用メモリ 309,972 KB
実行使用メモリ 40,720 KB
最終ジャッジ日時 2023-10-13 04:11:57
合計ジャッジ時間 12,776 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 1 ms
4,352 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 4 ms
4,352 KB
testcase_14 AC 37 ms
21,156 KB
testcase_15 AC 63 ms
32,116 KB
testcase_16 AC 55 ms
29,872 KB
testcase_17 AC 33 ms
18,788 KB
testcase_18 AC 42 ms
21,940 KB
testcase_19 AC 25 ms
14,436 KB
testcase_20 AC 77 ms
38,548 KB
testcase_21 AC 31 ms
17,520 KB
testcase_22 AC 43 ms
22,888 KB
testcase_23 AC 14 ms
9,684 KB
testcase_24 AC 77 ms
39,732 KB
testcase_25 AC 76 ms
38,836 KB
testcase_26 AC 15 ms
9,468 KB
testcase_27 AC 29 ms
16,656 KB
testcase_28 AC 14 ms
9,620 KB
testcase_29 AC 73 ms
37,636 KB
testcase_30 AC 26 ms
15,228 KB
testcase_31 AC 49 ms
26,168 KB
testcase_32 AC 36 ms
20,312 KB
testcase_33 AC 39 ms
20,172 KB
testcase_34 AC 66 ms
30,476 KB
testcase_35 AC 73 ms
28,944 KB
testcase_36 AC 6 ms
5,000 KB
testcase_37 AC 6 ms
4,788 KB
testcase_38 AC 73 ms
33,292 KB
testcase_39 AC 25 ms
13,108 KB
testcase_40 AC 86 ms
30,132 KB
testcase_41 AC 17 ms
9,668 KB
testcase_42 AC 39 ms
19,416 KB
testcase_43 AC 25 ms
13,768 KB
testcase_44 AC 41 ms
20,296 KB
testcase_45 AC 36 ms
18,540 KB
testcase_46 AC 19 ms
10,492 KB
testcase_47 AC 37 ms
19,384 KB
testcase_48 AC 45 ms
22,332 KB
testcase_49 AC 80 ms
30,124 KB
testcase_50 AC 56 ms
26,120 KB
testcase_51 AC 52 ms
23,524 KB
testcase_52 AC 11 ms
7,064 KB
testcase_53 AC 14 ms
9,028 KB
testcase_54 AC 59 ms
28,360 KB
testcase_55 AC 20 ms
10,864 KB
testcase_56 AC 82 ms
35,400 KB
testcase_57 AC 68 ms
25,040 KB
testcase_58 AC 115 ms
40,556 KB
testcase_59 AC 97 ms
40,720 KB
testcase_60 AC 99 ms
40,516 KB
testcase_61 AC 79 ms
40,552 KB
testcase_62 AC 77 ms
40,416 KB
testcase_63 AC 1 ms
4,352 KB
testcase_64 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint=modint998244353; //1000000007;
using ll=long long;
using pp=pair<int,int>;
#define sr string 
#define vc vector
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define pque priority_queue
#define bpc(a) __builtin_popcount(a)
int main(){
  int n,k;cin>>n>>k;
  vc<ll>v(n); rep(i,n)cin>>v[i];
  vc<int>vr(n);
  rep(i,n)vr[i]=(i+v[i])%n;
  int t=30;
  vc vx(t,vc<int>(n,0));
  vc vy(t,vc<ll>(n,0));
  vy[0]=v;
  vx[0]=vr;
  rep(i,t-1)rep(j,n)vx[i+1][j]=vx[i][vx[i][j]];
  rep(i,t-1)rep(j,n)vy[i+1][j]=vy[i][j]+vy[i][vx[i][j]];
  rep(i,n){
    int a=i;
    ll ans=i;
    for(int j=t-1;j>=0;j--)if(k>>j&1){
      ans+=vy[j][a];
      a=vx[j][a];
    }
    cout<<ans+1<<"\n";
  }
}
0