結果

問題 No.1013 〇マス進む
ユーザー 👑 emthrmemthrm
提出日時 2020-03-20 22:04:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 1,241 bytes
コンパイル時間 2,423 ms
コンパイル使用メモリ 206,200 KB
実行使用メモリ 27,904 KB
最終ジャッジ日時 2024-05-08 22:07:08
合計ジャッジ時間 8,118 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 3 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 4 ms
5,376 KB
testcase_14 AC 37 ms
14,976 KB
testcase_15 AC 70 ms
22,272 KB
testcase_16 AC 58 ms
20,480 KB
testcase_17 AC 33 ms
13,440 KB
testcase_18 AC 44 ms
15,744 KB
testcase_19 AC 24 ms
10,624 KB
testcase_20 AC 77 ms
26,496 KB
testcase_21 AC 32 ms
12,672 KB
testcase_22 AC 45 ms
16,256 KB
testcase_23 AC 14 ms
7,552 KB
testcase_24 AC 80 ms
27,264 KB
testcase_25 AC 81 ms
26,752 KB
testcase_26 AC 16 ms
7,552 KB
testcase_27 AC 28 ms
12,032 KB
testcase_28 AC 15 ms
7,552 KB
testcase_29 AC 76 ms
25,984 KB
testcase_30 AC 29 ms
11,008 KB
testcase_31 AC 51 ms
18,304 KB
testcase_32 AC 35 ms
14,464 KB
testcase_33 AC 43 ms
14,464 KB
testcase_34 AC 77 ms
21,120 KB
testcase_35 AC 80 ms
20,096 KB
testcase_36 AC 6 ms
5,376 KB
testcase_37 AC 6 ms
5,376 KB
testcase_38 AC 78 ms
23,040 KB
testcase_39 AC 29 ms
9,472 KB
testcase_40 AC 88 ms
20,992 KB
testcase_41 AC 20 ms
7,552 KB
testcase_42 AC 45 ms
13,952 KB
testcase_43 AC 29 ms
9,984 KB
testcase_44 AC 46 ms
14,592 KB
testcase_45 AC 43 ms
13,312 KB
testcase_46 AC 21 ms
7,936 KB
testcase_47 AC 41 ms
13,952 KB
testcase_48 AC 50 ms
16,000 KB
testcase_49 AC 92 ms
20,992 KB
testcase_50 AC 64 ms
18,304 KB
testcase_51 AC 56 ms
16,768 KB
testcase_52 AC 13 ms
6,016 KB
testcase_53 AC 16 ms
7,040 KB
testcase_54 AC 63 ms
19,968 KB
testcase_55 AC 25 ms
8,192 KB
testcase_56 AC 100 ms
24,704 KB
testcase_57 AC 79 ms
17,792 KB
testcase_58 AC 125 ms
27,776 KB
testcase_59 AC 120 ms
27,904 KB
testcase_60 AC 97 ms
27,904 KB
testcase_61 AC 71 ms
27,776 KB
testcase_62 AC 70 ms
27,776 KB
testcase_63 AC 2 ms
5,376 KB
testcase_64 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  const int M = 30;
  int n, k; cin >> n >> k;
  vector<int> p(n); REP(i, n) cin >> p[i];
  vector<vector<ll> > dp(M, vector<ll>(n));
  REP(i, n) dp[0][i] = p[i];
  REP(i, M - 1) REP(j, n) dp[i + 1][j] = dp[i][j] + dp[i][(j + dp[i][j]) % n];
  REP(i, n) {
    ll ans = 0;
    REP(j, M) if (k >> j & 1) ans += dp[j][(i + ans) % n];
    cout << i + ans + 1 << '\n';
  }
  return 0;
}
0