結果

問題 No.1013 〇マス進む
ユーザー どらら
提出日時 2020-03-21 01:43:38
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 723 bytes
コンパイル時間 1,472 ms
コンパイル使用メモリ 169,112 KB
実行使用メモリ 31,464 KB
最終ジャッジ日時 2024-12-16 02:12:30
合計ジャッジ時間 13,765 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34 WA * 14 RE * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

ll db[35][100005];

int main(){
  ll N, K;
  cin >> N >> K;
  vector<ll> P;
  rep(i,N){
    ll a;
    cin >> a;
    P.push_back(a);
    db[0][i] = a;
  }

  rep(i,34){
    rep(j,N){
      db[i+1][j] = db[i][j] + db[i][(db[i][j]+j)%N];
    }
  }
  
  rep(i,N){
    int pos = i;
    for(int j=34; j>=0; j--){
      if((K>>j)&1){
        pos += db[j][pos%N];
      }
    }
    cout << pos+1 << endl;
  }
  
  
  return 0;
}

0