結果

問題 No.1013 〇マス進む
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2020-03-21 10:43:07
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 1,845 bytes
コンパイル時間 1,928 ms
コンパイル使用メモリ 199,124 KB
実行使用メモリ 28,404 KB
最終ジャッジ日時 2023-08-23 07:01:09
合計ジャッジ時間 11,225 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
26,164 KB
testcase_01 AC 6 ms
26,192 KB
testcase_02 AC 5 ms
25,984 KB
testcase_03 AC 6 ms
26,008 KB
testcase_04 AC 6 ms
26,032 KB
testcase_05 AC 6 ms
25,988 KB
testcase_06 AC 6 ms
26,052 KB
testcase_07 AC 6 ms
26,044 KB
testcase_08 AC 6 ms
26,016 KB
testcase_09 AC 6 ms
26,244 KB
testcase_10 AC 6 ms
26,060 KB
testcase_11 AC 6 ms
26,112 KB
testcase_12 AC 6 ms
26,028 KB
testcase_13 AC 9 ms
26,068 KB
testcase_14 AC 36 ms
27,212 KB
testcase_15 AC 62 ms
27,932 KB
testcase_16 AC 54 ms
27,788 KB
testcase_17 AC 33 ms
27,260 KB
testcase_18 AC 44 ms
27,284 KB
testcase_19 AC 26 ms
26,768 KB
testcase_20 AC 73 ms
28,204 KB
testcase_21 AC 30 ms
26,940 KB
testcase_22 AC 43 ms
27,604 KB
testcase_23 AC 16 ms
26,420 KB
testcase_24 AC 72 ms
28,300 KB
testcase_25 AC 72 ms
28,236 KB
testcase_26 AC 18 ms
26,504 KB
testcase_27 AC 27 ms
26,876 KB
testcase_28 AC 17 ms
26,400 KB
testcase_29 AC 68 ms
28,364 KB
testcase_30 AC 29 ms
27,000 KB
testcase_31 AC 48 ms
27,608 KB
testcase_32 AC 33 ms
27,160 KB
testcase_33 AC 40 ms
27,124 KB
testcase_34 AC 69 ms
27,980 KB
testcase_35 AC 73 ms
27,924 KB
testcase_36 AC 10 ms
26,136 KB
testcase_37 AC 9 ms
26,096 KB
testcase_38 AC 73 ms
27,924 KB
testcase_39 AC 31 ms
26,624 KB
testcase_40 AC 83 ms
27,780 KB
testcase_41 AC 22 ms
26,516 KB
testcase_42 AC 46 ms
27,180 KB
testcase_43 AC 28 ms
26,644 KB
testcase_44 AC 44 ms
27,164 KB
testcase_45 AC 40 ms
27,108 KB
testcase_46 AC 24 ms
26,440 KB
testcase_47 AC 41 ms
27,140 KB
testcase_48 AC 47 ms
27,580 KB
testcase_49 AC 86 ms
28,032 KB
testcase_50 AC 60 ms
27,604 KB
testcase_51 AC 54 ms
27,524 KB
testcase_52 AC 16 ms
26,240 KB
testcase_53 AC 19 ms
26,360 KB
testcase_54 AC 61 ms
27,748 KB
testcase_55 AC 27 ms
26,664 KB
testcase_56 AC 95 ms
28,124 KB
testcase_57 AC 71 ms
27,488 KB
testcase_58 AC 115 ms
28,308 KB
testcase_59 AC 113 ms
28,304 KB
testcase_60 AC 93 ms
28,404 KB
testcase_61 AC 67 ms
28,300 KB
testcase_62 AC 61 ms
28,360 KB
testcase_63 AC 6 ms
26,024 KB
testcase_64 AC 6 ms
25,996 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(cu, 0, N) nxt[0][cu] = P[cu];
	rep(p, 1, 31) rep(cu, 0, N) nxt[p][cu] = nxt[p - 1][cu] + nxt[p - 1][(cu + nxt[p - 1][cu]) % N];

	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