結果

問題 No.1013 〇マス進む
ユーザー momoharamomohara
提出日時 2020-03-20 22:30:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 174 ms / 2,000 ms
コード長 2,006 bytes
コンパイル時間 1,154 ms
コンパイル使用メモリ 105,692 KB
実行使用メモリ 44,800 KB
最終ジャッジ日時 2024-05-08 22:46:49
合計ジャッジ時間 8,108 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 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 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 3 ms
5,376 KB
testcase_13 AC 6 ms
5,376 KB
testcase_14 AC 57 ms
23,040 KB
testcase_15 AC 97 ms
35,328 KB
testcase_16 AC 85 ms
32,512 KB
testcase_17 AC 49 ms
20,480 KB
testcase_18 AC 65 ms
24,320 KB
testcase_19 AC 38 ms
15,872 KB
testcase_20 AC 114 ms
42,496 KB
testcase_21 AC 45 ms
19,072 KB
testcase_22 AC 65 ms
25,216 KB
testcase_23 AC 21 ms
10,496 KB
testcase_24 AC 116 ms
43,776 KB
testcase_25 AC 116 ms
43,136 KB
testcase_26 AC 23 ms
10,368 KB
testcase_27 AC 42 ms
18,048 KB
testcase_28 AC 22 ms
10,368 KB
testcase_29 AC 110 ms
41,728 KB
testcase_30 AC 41 ms
16,512 KB
testcase_31 AC 74 ms
28,800 KB
testcase_32 AC 51 ms
22,272 KB
testcase_33 AC 60 ms
22,144 KB
testcase_34 AC 103 ms
33,280 KB
testcase_35 AC 107 ms
31,744 KB
testcase_36 AC 8 ms
5,376 KB
testcase_37 AC 9 ms
5,376 KB
testcase_38 AC 111 ms
36,608 KB
testcase_39 AC 41 ms
13,952 KB
testcase_40 AC 121 ms
33,152 KB
testcase_41 AC 28 ms
10,624 KB
testcase_42 AC 67 ms
21,376 KB
testcase_43 AC 40 ms
14,720 KB
testcase_44 AC 65 ms
22,272 KB
testcase_45 AC 58 ms
20,096 KB
testcase_46 AC 31 ms
11,136 KB
testcase_47 AC 60 ms
21,376 KB
testcase_48 AC 70 ms
24,576 KB
testcase_49 AC 122 ms
33,280 KB
testcase_50 AC 87 ms
28,800 KB
testcase_51 AC 78 ms
25,984 KB
testcase_52 AC 17 ms
7,552 KB
testcase_53 AC 24 ms
9,600 KB
testcase_54 AC 91 ms
31,488 KB
testcase_55 AC 34 ms
11,776 KB
testcase_56 AC 140 ms
39,168 KB
testcase_57 AC 101 ms
27,648 KB
testcase_58 AC 174 ms
44,672 KB
testcase_59 AC 162 ms
44,800 KB
testcase_60 AC 139 ms
44,672 KB
testcase_61 AC 113 ms
44,672 KB
testcase_62 AC 108 ms
44,672 KB
testcase_63 AC 2 ms
5,376 KB
testcase_64 AC 2 ms
5,376 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