結果

問題 No.1097 Remainder Operation
ユーザー uzzyuzzy
提出日時 2020-06-26 22:49:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 341 ms / 2,000 ms
コード長 914 bytes
コンパイル時間 2,526 ms
コンパイル使用メモリ 182,128 KB
実行使用メモリ 34,824 KB
最終ジャッジ日時 2023-09-18 06:42:05
合計ジャッジ時間 7,474 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 15 ms
8,584 KB
testcase_08 AC 15 ms
6,756 KB
testcase_09 AC 14 ms
8,332 KB
testcase_10 AC 14 ms
7,128 KB
testcase_11 AC 14 ms
6,884 KB
testcase_12 AC 235 ms
34,600 KB
testcase_13 AC 226 ms
34,592 KB
testcase_14 AC 235 ms
34,652 KB
testcase_15 AC 223 ms
34,788 KB
testcase_16 AC 241 ms
34,580 KB
testcase_17 AC 218 ms
34,824 KB
testcase_18 AC 175 ms
34,588 KB
testcase_19 AC 233 ms
34,560 KB
testcase_20 AC 255 ms
34,644 KB
testcase_21 AC 328 ms
34,620 KB
testcase_22 AC 341 ms
34,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


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


	int N;
	cin >> N;

	ll A[100000][40];
	rep(i, N) cin >> A[i][0];
	rep(j, 39) {
		rep(i, N) {
			A[i][j + 1] = A[i][j] + A[(i + A[i][j]) % N][j];
		}
	}

	int Q;
	cin >> Q;
	rep(i, Q) {
		ll K;
		cin >> K;

		ll kotae = 0;
		rep(j, 40) {
			if (K >> j & 1) {
				kotae += A[kotae % N][j];
			}
		}
		co(kotae);
	}



	Would you please return 0;
}
0