結果

問題 No.1013 〇マス進む
ユーザー DAyamaCTFDAyamaCTF
提出日時 2020-03-23 14:41:11
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 246 ms / 2,000 ms
コード長 1,142 bytes
コンパイル時間 2,194 ms
コンパイル使用メモリ 148,696 KB
実行使用メモリ 52,280 KB
最終ジャッジ日時 2023-08-27 01:27:19
合計ジャッジ時間 12,066 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
48,380 KB
testcase_01 AC 11 ms
48,540 KB
testcase_02 AC 11 ms
48,420 KB
testcase_03 AC 11 ms
48,424 KB
testcase_04 AC 11 ms
48,440 KB
testcase_05 AC 11 ms
48,616 KB
testcase_06 AC 11 ms
48,440 KB
testcase_07 AC 11 ms
48,436 KB
testcase_08 AC 11 ms
48,620 KB
testcase_09 AC 12 ms
48,424 KB
testcase_10 AC 11 ms
48,436 KB
testcase_11 AC 11 ms
48,560 KB
testcase_12 AC 12 ms
48,448 KB
testcase_13 AC 16 ms
48,592 KB
testcase_14 AC 93 ms
50,140 KB
testcase_15 AC 148 ms
51,356 KB
testcase_16 AC 124 ms
51,192 KB
testcase_17 AC 77 ms
50,036 KB
testcase_18 AC 99 ms
50,460 KB
testcase_19 AC 57 ms
49,636 KB
testcase_20 AC 167 ms
51,892 KB
testcase_21 AC 65 ms
49,844 KB
testcase_22 AC 96 ms
50,432 KB
testcase_23 AC 35 ms
49,096 KB
testcase_24 AC 166 ms
52,164 KB
testcase_25 AC 175 ms
52,144 KB
testcase_26 AC 36 ms
49,020 KB
testcase_27 AC 65 ms
49,780 KB
testcase_28 AC 36 ms
49,080 KB
testcase_29 AC 162 ms
52,000 KB
testcase_30 AC 64 ms
49,804 KB
testcase_31 AC 116 ms
50,928 KB
testcase_32 AC 82 ms
50,172 KB
testcase_33 AC 91 ms
50,128 KB
testcase_34 AC 141 ms
51,172 KB
testcase_35 AC 145 ms
51,192 KB
testcase_36 AC 18 ms
48,580 KB
testcase_37 AC 17 ms
48,864 KB
testcase_38 AC 152 ms
51,648 KB
testcase_39 AC 57 ms
49,400 KB
testcase_40 AC 155 ms
51,212 KB
testcase_41 AC 40 ms
49,212 KB
testcase_42 AC 83 ms
50,044 KB
testcase_43 AC 58 ms
49,480 KB
testcase_44 AC 89 ms
50,208 KB
testcase_45 AC 74 ms
49,948 KB
testcase_46 AC 43 ms
49,228 KB
testcase_47 AC 89 ms
50,036 KB
testcase_48 AC 102 ms
50,320 KB
testcase_49 AC 154 ms
51,088 KB
testcase_50 AC 126 ms
51,124 KB
testcase_51 AC 108 ms
50,584 KB
testcase_52 AC 27 ms
48,824 KB
testcase_53 AC 35 ms
49,320 KB
testcase_54 AC 146 ms
51,216 KB
testcase_55 AC 45 ms
49,152 KB
testcase_56 AC 193 ms
51,704 KB
testcase_57 AC 124 ms
50,684 KB
testcase_58 AC 215 ms
52,248 KB
testcase_59 AC 209 ms
52,228 KB
testcase_60 AC 246 ms
52,268 KB
testcase_61 AC 180 ms
52,280 KB
testcase_62 AC 152 ms
52,220 KB
testcase_63 AC 11 ms
48,468 KB
testcase_64 AC 11 ms
48,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

P operator*(const P& a,const P& b){
	return P(a.fi+b.fi,b.se);
}

ll N,K;
vector<ll> A;
P f[31][100010];

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin>>N>>K;
  A.resize(N);
  rep(i,N)cin>>A[i];
  rep(i,N){
  	if(i+A[i]>=N) f[0][i]=P(1,(i+A[i])%N);
  	else f[0][i]=P(0,(i+A[i])%N);
  }

  rep(k,30){
  	rep(i,N){
  		f[k+1][i]=f[k][i]*f[k][f[k][i].se];
  	}
  }

  K--;
  rep(i,N){
  	P res=f[0][i];
  	rep(k,30){
  		if((K>>k)&1){
  			res=res*f[k][res.se];
  		}
  	}
  	cout<<res.fi*N+res.se+1<<endl;
  }

  return 0;
}
0