結果

問題 No.1013 〇マス進む
ユーザー heabiheabi
提出日時 2020-11-25 00:08:50
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 193 ms / 2,000 ms
コード長 2,375 bytes
コンパイル時間 2,212 ms
コンパイル使用メモリ 168,960 KB
実行使用メモリ 51,712 KB
最終ジャッジ日時 2023-10-01 01:23:31
合計ジャッジ時間 9,174 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 3 ms
4,380 KB
testcase_13 AC 6 ms
4,816 KB
testcase_14 AC 62 ms
26,276 KB
testcase_15 AC 107 ms
40,800 KB
testcase_16 AC 95 ms
37,520 KB
testcase_17 AC 56 ms
23,264 KB
testcase_18 AC 72 ms
27,808 KB
testcase_19 AC 41 ms
17,720 KB
testcase_20 AC 128 ms
49,420 KB
testcase_21 AC 50 ms
21,772 KB
testcase_22 AC 72 ms
28,924 KB
testcase_23 AC 23 ms
11,672 KB
testcase_24 AC 129 ms
50,572 KB
testcase_25 AC 127 ms
49,664 KB
testcase_26 AC 24 ms
11,500 KB
testcase_27 AC 46 ms
20,732 KB
testcase_28 AC 23 ms
11,496 KB
testcase_29 AC 121 ms
48,188 KB
testcase_30 AC 45 ms
18,780 KB
testcase_31 AC 81 ms
33,152 KB
testcase_32 AC 57 ms
25,648 KB
testcase_33 AC 66 ms
25,488 KB
testcase_34 AC 113 ms
38,428 KB
testcase_35 AC 118 ms
36,584 KB
testcase_36 AC 9 ms
5,376 KB
testcase_37 AC 8 ms
5,148 KB
testcase_38 AC 121 ms
42,108 KB
testcase_39 AC 44 ms
15,604 KB
testcase_40 AC 132 ms
38,168 KB
testcase_41 AC 30 ms
11,756 KB
testcase_42 AC 70 ms
24,320 KB
testcase_43 AC 43 ms
16,816 KB
testcase_44 AC 71 ms
25,716 KB
testcase_45 AC 64 ms
22,772 KB
testcase_46 AC 33 ms
12,436 KB
testcase_47 AC 65 ms
24,604 KB
testcase_48 AC 77 ms
28,140 KB
testcase_49 AC 133 ms
38,152 KB
testcase_50 AC 97 ms
33,304 KB
testcase_51 AC 86 ms
29,956 KB
testcase_52 AC 19 ms
8,328 KB
testcase_53 AC 26 ms
10,648 KB
testcase_54 AC 101 ms
36,224 KB
testcase_55 AC 37 ms
13,132 KB
testcase_56 AC 148 ms
45,292 KB
testcase_57 AC 108 ms
31,816 KB
testcase_58 AC 193 ms
51,676 KB
testcase_59 AC 179 ms
51,712 KB
testcase_60 AC 153 ms
51,508 KB
testcase_61 AC 123 ms
51,628 KB
testcase_62 AC 117 ms
51,604 KB
testcase_63 AC 2 ms
4,380 KB
testcase_64 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define ll long long

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep_up(i, a, b) for (ll i = a; i < b; ++i)
#define rep_down(i, a, b) for (ll i = a; i > b; --i)

#define P pair<ll, ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second

#define vvvvll vector<vector<vector<vector<ll>>>>
#define vvvll vector<vector<vector<ll>>>
#define vvll vector<vector<ll>>
#define vll vector<ll>

#define vvvvdo vector<vector<vector<vector<double>>>>
#define vvvdo vector<vector<vector<double>>>
#define vvdo vector<vector<double>>
#define vdo vector<double>

#define pqll priority_queue<ll>
#define pqllg priority_queue<ll, vector<ll>, greater<ll>>

constexpr ll INF = (1ll << 60);
// constexpr ll mod = 998244353;
constexpr ll mod = 1000000007;
// constexpr ll mod = 67280421310721;
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

void pt_vvll(vvll v) {
    ll vs = v.size(), vs0 = v[0].size();
    rep(i, vs) {
        rep(j, vs0) {
            if (v[i][j] != INF)
                cout << v[i][j];
            else
                cout << -1;

            if (j != vs0 - 1)
                cout << " ";
            else
                cout << "\n";
        }
    }
}
void pt_vll(vll v) {
    ll vs = v.size();
    rep(i, vs) {
        cout << v[i];
        if (i == vs - 1)
            cout << "\n";
        else
            cout << " ";
    }
}

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

    ll N, K;
    cin >> N >> K;
    vll A(N);
    rep(i, N) cin >> A[i];

    vvll db(60, vll(N));
    rep(i, N) db[0][i] = i + A[i];
    // db[k][i] := iから2^k回操作してたどり着く番号

    rep(jump, 59) {
        rep(now, N) {
            db[jump + 1][now] =
                db[jump][db[jump][now] % N] + (db[jump][now] / N) * N;
        }
    }

    rep(i, N) {
        ll now = i, see = K;
        for (ll jump = 0; see > 0; jump++) {
            if (see & 1) {
                now = db[jump][now % N] + (now / N) * N;
            }
            see = see >> 1;
        }

        cout << now + 1 << "\n";
    }
    return 0;
}
0