結果
問題 |
No.1013 〇マス進む
|
ユーザー |
![]() |
提出日時 | 2023-10-13 04:09:55 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 866 bytes |
コンパイル時間 | 5,229 ms |
コンパイル使用メモリ | 310,208 KB |
実行使用メモリ | 28,112 KB |
最終ジャッジ日時 | 2024-09-15 01:45:35 |
合計ジャッジ時間 | 11,591 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 WA * 28 |
ソースコード
#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<int>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<int>(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; int 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"; } }