結果

問題 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
コンパイル時間 3,224 ms
コンパイル使用メモリ 203,996 KB
実行使用メモリ 27,892 KB
最終ジャッジ日時 2023-08-21 16:40:53
合計ジャッジ時間 8,749 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 4 ms
4,380 KB
testcase_14 AC 37 ms
14,852 KB
testcase_15 AC 66 ms
22,240 KB
testcase_16 AC 57 ms
20,396 KB
testcase_17 AC 33 ms
13,396 KB
testcase_18 AC 44 ms
15,776 KB
testcase_19 AC 25 ms
10,624 KB
testcase_20 AC 79 ms
26,588 KB
testcase_21 AC 30 ms
12,584 KB
testcase_22 AC 45 ms
16,164 KB
testcase_23 AC 14 ms
7,308 KB
testcase_24 AC 80 ms
27,316 KB
testcase_25 AC 79 ms
26,772 KB
testcase_26 AC 15 ms
7,272 KB
testcase_27 AC 26 ms
11,996 KB
testcase_28 AC 14 ms
7,332 KB
testcase_29 AC 74 ms
26,008 KB
testcase_30 AC 28 ms
11,008 KB
testcase_31 AC 50 ms
18,400 KB
testcase_32 AC 34 ms
14,432 KB
testcase_33 AC 42 ms
14,312 KB
testcase_34 AC 74 ms
21,024 KB
testcase_35 AC 77 ms
20,176 KB
testcase_36 AC 6 ms
4,376 KB
testcase_37 AC 6 ms
4,376 KB
testcase_38 AC 79 ms
22,864 KB
testcase_39 AC 30 ms
9,332 KB
testcase_40 AC 91 ms
20,920 KB
testcase_41 AC 20 ms
7,512 KB
testcase_42 AC 47 ms
13,844 KB
testcase_43 AC 28 ms
9,840 KB
testcase_44 AC 46 ms
14,380 KB
testcase_45 AC 42 ms
13,000 KB
testcase_46 AC 22 ms
7,804 KB
testcase_47 AC 42 ms
13,996 KB
testcase_48 AC 49 ms
15,768 KB
testcase_49 AC 94 ms
21,156 KB
testcase_50 AC 64 ms
18,344 KB
testcase_51 AC 57 ms
16,808 KB
testcase_52 AC 13 ms
5,720 KB
testcase_53 AC 18 ms
6,936 KB
testcase_54 AC 66 ms
19,876 KB
testcase_55 AC 25 ms
8,060 KB
testcase_56 AC 102 ms
24,468 KB
testcase_57 AC 74 ms
17,552 KB
testcase_58 AC 125 ms
27,828 KB
testcase_59 AC 119 ms
27,836 KB
testcase_60 AC 101 ms
27,832 KB
testcase_61 AC 73 ms
27,836 KB
testcase_62 AC 68 ms
27,892 KB
testcase_63 AC 1 ms
4,376 KB
testcase_64 AC 1 ms
4,380 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