結果

問題 No.1013 〇マス進む
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2020-03-20 22:59:13
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 1,837 bytes
コンパイル時間 2,561 ms
コンパイル使用メモリ 198,732 KB
実行使用メモリ 28,388 KB
最終ジャッジ日時 2023-08-21 18:14:25
合計ジャッジ時間 9,354 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
26,184 KB
testcase_01 AC 6 ms
26,188 KB
testcase_02 AC 7 ms
25,988 KB
testcase_03 AC 6 ms
25,992 KB
testcase_04 AC 7 ms
26,052 KB
testcase_05 AC 7 ms
26,188 KB
testcase_06 AC 7 ms
25,996 KB
testcase_07 AC 6 ms
26,068 KB
testcase_08 AC 6 ms
26,140 KB
testcase_09 AC 6 ms
26,004 KB
testcase_10 AC 7 ms
26,064 KB
testcase_11 AC 6 ms
26,020 KB
testcase_12 AC 7 ms
26,152 KB
testcase_13 AC 9 ms
26,076 KB
testcase_14 AC 38 ms
27,260 KB
testcase_15 AC 64 ms
27,924 KB
testcase_16 AC 57 ms
27,864 KB
testcase_17 AC 33 ms
27,012 KB
testcase_18 AC 45 ms
27,312 KB
testcase_19 AC 27 ms
26,768 KB
testcase_20 AC 75 ms
28,228 KB
testcase_21 AC 30 ms
27,068 KB
testcase_22 AC 44 ms
27,396 KB
testcase_23 AC 16 ms
26,380 KB
testcase_24 AC 74 ms
28,388 KB
testcase_25 AC 73 ms
28,284 KB
testcase_26 AC 18 ms
26,408 KB
testcase_27 AC 27 ms
26,920 KB
testcase_28 AC 17 ms
26,588 KB
testcase_29 AC 70 ms
28,284 KB
testcase_30 AC 30 ms
26,792 KB
testcase_31 AC 48 ms
27,576 KB
testcase_32 AC 34 ms
27,188 KB
testcase_33 AC 42 ms
27,188 KB
testcase_34 AC 72 ms
28,016 KB
testcase_35 AC 76 ms
27,684 KB
testcase_36 AC 10 ms
26,124 KB
testcase_37 AC 10 ms
26,352 KB
testcase_38 AC 75 ms
27,976 KB
testcase_39 AC 32 ms
26,660 KB
testcase_40 AC 88 ms
27,820 KB
testcase_41 AC 23 ms
26,488 KB
testcase_42 AC 47 ms
27,080 KB
testcase_43 AC 30 ms
26,644 KB
testcase_44 AC 45 ms
27,272 KB
testcase_45 AC 41 ms
27,052 KB
testcase_46 AC 25 ms
26,584 KB
testcase_47 AC 42 ms
27,144 KB
testcase_48 AC 49 ms
27,412 KB
testcase_49 AC 89 ms
27,820 KB
testcase_50 AC 62 ms
27,608 KB
testcase_51 AC 55 ms
27,368 KB
testcase_52 AC 16 ms
26,388 KB
testcase_53 AC 20 ms
26,420 KB
testcase_54 AC 62 ms
27,684 KB
testcase_55 AC 28 ms
26,524 KB
testcase_56 AC 98 ms
28,120 KB
testcase_57 AC 72 ms
27,576 KB
testcase_58 AC 127 ms
28,320 KB
testcase_59 AC 115 ms
28,292 KB
testcase_60 AC 93 ms
28,332 KB
testcase_61 AC 67 ms
28,296 KB
testcase_62 AC 62 ms
28,332 KB
testcase_63 AC 6 ms
25,984 KB
testcase_64 AC 6 ms
25,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     @hamayanhamayan0
    /   \     | |
    /   / ̄ ̄ ̄ ̄/  |
  __(__ニつ/     _/ .| .|____
     \/____/ (u ⊃
---------------------------------------------------------------------------------------------------*/














int N, K, P[101010];
ll nxt[31][101010];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N >> K;
	rep(i, 0, N) cin >> P[i];

	rep(i, 0, N) nxt[0][i] = P[i];
	rep(p, 1, 31) rep(i, 0, N) nxt[p][i] = nxt[p - 1][(i + nxt[p - 1][i]) % N] + nxt[p - 1][i];

	rep(i, 0, N) {
		ll ans = i + 1;
		int cu = i;
		rep(p, 0, 31) {
			int msk = 1 << p;
			if (K & msk) {
				ans += nxt[p][cu];
				cu = (cu + nxt[p][cu]) % N;
			}
		}
		printf("%lld\n", ans);
	}
}





0