結果

問題 No.1013 〇マス進む
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2020-03-20 22:59:13
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 1,837 bytes
コンパイル時間 2,249 ms
コンパイル使用メモリ 200,048 KB
実行使用メモリ 28,540 KB
最終ジャッジ日時 2024-05-08 23:54:45
合計ジャッジ時間 8,410 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 AC 3 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 3 ms
5,376 KB
testcase_10 AC 3 ms
5,376 KB
testcase_11 AC 4 ms
5,376 KB
testcase_12 AC 4 ms
5,376 KB
testcase_13 AC 7 ms
5,376 KB
testcase_14 AC 40 ms
15,616 KB
testcase_15 AC 67 ms
22,912 KB
testcase_16 AC 60 ms
21,120 KB
testcase_17 AC 37 ms
13,952 KB
testcase_18 AC 47 ms
16,384 KB
testcase_19 AC 28 ms
11,136 KB
testcase_20 AC 83 ms
27,136 KB
testcase_21 AC 33 ms
13,312 KB
testcase_22 AC 48 ms
16,896 KB
testcase_23 AC 17 ms
7,936 KB
testcase_24 AC 79 ms
27,904 KB
testcase_25 AC 79 ms
27,392 KB
testcase_26 AC 18 ms
7,936 KB
testcase_27 AC 29 ms
12,800 KB
testcase_28 AC 17 ms
8,064 KB
testcase_29 AC 76 ms
26,752 KB
testcase_30 AC 31 ms
11,776 KB
testcase_31 AC 52 ms
18,816 KB
testcase_32 AC 35 ms
14,976 KB
testcase_33 AC 44 ms
15,104 KB
testcase_34 AC 77 ms
21,888 KB
testcase_35 AC 80 ms
20,864 KB
testcase_36 AC 9 ms
5,376 KB
testcase_37 AC 9 ms
5,376 KB
testcase_38 AC 79 ms
23,552 KB
testcase_39 AC 33 ms
10,240 KB
testcase_40 AC 93 ms
21,632 KB
testcase_41 AC 24 ms
8,064 KB
testcase_42 AC 50 ms
14,592 KB
testcase_43 AC 32 ms
10,624 KB
testcase_44 AC 48 ms
15,232 KB
testcase_45 AC 43 ms
13,824 KB
testcase_46 AC 25 ms
8,704 KB
testcase_47 AC 44 ms
14,464 KB
testcase_48 AC 51 ms
16,640 KB
testcase_49 AC 96 ms
21,632 KB
testcase_50 AC 63 ms
18,944 KB
testcase_51 AC 58 ms
17,280 KB
testcase_52 AC 15 ms
6,400 KB
testcase_53 AC 19 ms
7,680 KB
testcase_54 AC 64 ms
20,736 KB
testcase_55 AC 28 ms
8,832 KB
testcase_56 AC 102 ms
25,088 KB
testcase_57 AC 79 ms
18,432 KB
testcase_58 AC 131 ms
28,540 KB
testcase_59 AC 124 ms
28,416 KB
testcase_60 AC 96 ms
28,416 KB
testcase_61 AC 72 ms
28,416 KB
testcase_62 AC 63 ms
28,288 KB
testcase_63 AC 3 ms
5,376 KB
testcase_64 AC 3 ms
5,376 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