結果

問題 No.1013 〇マス進む
ユーザー momoharamomohara
提出日時 2020-03-20 22:30:42
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 164 ms / 2,000 ms
コード長 2,006 bytes
コンパイル時間 891 ms
コンパイル使用メモリ 105,016 KB
実行使用メモリ 44,608 KB
最終ジャッジ日時 2023-08-21 17:17:37
合計ジャッジ時間 7,983 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,384 KB
testcase_13 AC 6 ms
4,620 KB
testcase_14 AC 55 ms
23,104 KB
testcase_15 AC 93 ms
35,256 KB
testcase_16 AC 82 ms
32,544 KB
testcase_17 AC 48 ms
20,444 KB
testcase_18 AC 61 ms
24,160 KB
testcase_19 AC 36 ms
15,740 KB
testcase_20 AC 112 ms
42,408 KB
testcase_21 AC 44 ms
18,824 KB
testcase_22 AC 63 ms
25,160 KB
testcase_23 AC 21 ms
10,140 KB
testcase_24 AC 112 ms
43,704 KB
testcase_25 AC 111 ms
42,796 KB
testcase_26 AC 22 ms
10,228 KB
testcase_27 AC 40 ms
18,116 KB
testcase_28 AC 20 ms
10,260 KB
testcase_29 AC 106 ms
41,580 KB
testcase_30 AC 40 ms
16,512 KB
testcase_31 AC 71 ms
28,796 KB
testcase_32 AC 50 ms
22,048 KB
testcase_33 AC 58 ms
22,044 KB
testcase_34 AC 99 ms
33,396 KB
testcase_35 AC 101 ms
31,496 KB
testcase_36 AC 9 ms
5,156 KB
testcase_37 AC 7 ms
4,832 KB
testcase_38 AC 106 ms
36,456 KB
testcase_39 AC 39 ms
13,892 KB
testcase_40 AC 115 ms
33,136 KB
testcase_41 AC 27 ms
10,500 KB
testcase_42 AC 63 ms
21,236 KB
testcase_43 AC 39 ms
14,668 KB
testcase_44 AC 64 ms
22,212 KB
testcase_45 AC 57 ms
19,880 KB
testcase_46 AC 28 ms
11,120 KB
testcase_47 AC 58 ms
21,232 KB
testcase_48 AC 67 ms
24,312 KB
testcase_49 AC 116 ms
33,140 KB
testcase_50 AC 84 ms
28,648 KB
testcase_51 AC 75 ms
26,012 KB
testcase_52 AC 17 ms
7,552 KB
testcase_53 AC 23 ms
9,668 KB
testcase_54 AC 90 ms
31,548 KB
testcase_55 AC 33 ms
11,480 KB
testcase_56 AC 133 ms
39,320 KB
testcase_57 AC 95 ms
27,492 KB
testcase_58 AC 164 ms
44,492 KB
testcase_59 AC 156 ms
44,516 KB
testcase_60 AC 138 ms
44,516 KB
testcase_61 AC 109 ms
44,608 KB
testcase_62 AC 107 ms
44,484 KB
testcase_63 AC 2 ms
4,376 KB
testcase_64 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define rep(i,m,n) for(int (i)=(int)(m);(i)<(int)(n);(i)++)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;(i)>=(int)(m);(i)--)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9+7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;


template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

struct Edge {
	int to, cap, rev;
	Edge(int _to, int _cap, int _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, int from, int to, int cap, bool revFlag, int revCap) {
	G[from].push_back(Edge(to, cap, G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, G[from].size() - 1));
}

void solve() {
	ll n, k;
	cin >> n >> k;
	Array p(n);
	REP(i, n) cin >> p[i];
	Matrix t(51, Array(n,0));
	REP(i, n) t[0][i] = p[i];

	REP(i, 50) {
		REP(j, n) {
			t[i + 1][j] = t[i][j] + t[i][(j + t[i][j]) % n];
		}
	}

	REP(i, n) {
		ll pos = i;
		REP(j, 51) {
			if (k & (1LL << j)) {
				pos += t[j][pos % n];
			}
		}
		cout << pos+1 << en;
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	solve();
	//int t; cin >> t; REP(i, t) solve();

	return 0;
}
0