結果
問題 |
No.1013 〇マス進む
|
ユーザー |
|
提出日時 | 2020-03-21 03:18:10 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,101 bytes |
コンパイル時間 | 1,784 ms |
コンパイル使用メモリ | 168,468 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-12-16 06:57:23 |
合計ジャッジ時間 | 104,218 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 TLE * 28 |
ソースコード
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (n); ++i) #define rep1(i, n) for (ll i = 1; i <= (n); ++i) #define rrep(i, n) for (ll i = (n - 1); i >= 0; --i) #define ALL(obj) (obj).begin(), (obj).end() #define pb push_back #define to_s to_string #define len(v) (ll)v.size() #define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) #define print(x) cout << (x) << '\n' #define debug(x) cout << #x << ": " << (x) << '\n' using namespace std; using ll = long long; typedef pair<ll, ll> P; ll MOD = 1e9 + 7; ll devc(ll x, ll y) { return 1 + (x - 1) / y; } int main() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(20); ll N, K; cin >> N >> K; vector<ll> P(N + 5); rep1(i, N) cin >> P[i]; rep1(i,N){ ll now = i; ll ans = 0; rep(j, K){ now += P[now % N == 0 ? N : now % N]; if(P[now % N == 0 ? N : now % N] == N){ ans = now + (K-j-1)*N; break; } } if(ans == 0) print(now); else print(ans); } return 0; }