結果
問題 | No.1013 〇マス進む |
ユーザー | heabi |
提出日時 | 2020-11-25 00:03:46 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 2,594 bytes |
コンパイル時間 | 1,642 ms |
コンパイル使用メモリ | 171,656 KB |
実行使用メモリ | 51,968 KB |
最終ジャッジ日時 | 2024-07-23 18:57:25 |
合計ジャッジ時間 | 25,685 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 3 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | RE | - |
testcase_27 | RE | - |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | RE | - |
testcase_33 | RE | - |
testcase_34 | RE | - |
testcase_35 | RE | - |
testcase_36 | RE | - |
testcase_37 | RE | - |
testcase_38 | RE | - |
testcase_39 | RE | - |
testcase_40 | RE | - |
testcase_41 | RE | - |
testcase_42 | RE | - |
testcase_43 | RE | - |
testcase_44 | RE | - |
testcase_45 | RE | - |
testcase_46 | RE | - |
testcase_47 | RE | - |
testcase_48 | RE | - |
testcase_49 | RE | - |
testcase_50 | RE | - |
testcase_51 | RE | - |
testcase_52 | RE | - |
testcase_53 | RE | - |
testcase_54 | RE | - |
testcase_55 | RE | - |
testcase_56 | RE | - |
testcase_57 | RE | - |
testcase_58 | RE | - |
testcase_59 | RE | - |
testcase_60 | RE | - |
testcase_61 | RE | - |
testcase_62 | RE | - |
testcase_63 | AC | 2 ms
5,376 KB |
testcase_64 | AC | 2 ms
5,376 KB |
ソースコード
#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) { if (db[jump][now] >= N) db[jump + 1][now] = db[jump][db[jump][now] % N] + (db[jump][now] / N) * N; else db[jump + 1][now] = db[jump][db[jump][now]]; } } rep(i, N) { ll now = i, see = K; for (ll jump = 0; see > 0; jump++) { if (see & 1) { if (now >= N) now = db[jump][now % N] + (now / N) * N; else now = db[jump][now]; } see = see >> 1; } cout << now + 1 << "\n"; } return 0; }