結果

問題 No.1097 Remainder Operation
ユーザー 👑 NachiaNachia
提出日時 2020-10-04 13:11:35
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 404 ms / 2,000 ms
コード長 424 bytes
コンパイル時間 1,394 ms
コンパイル使用メモリ 164,648 KB
実行使用メモリ 35,652 KB
最終ジャッジ日時 2023-09-26 14:59:25
合計ジャッジ時間 9,249 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
32,332 KB
testcase_01 AC 7 ms
32,008 KB
testcase_02 AC 8 ms
32,020 KB
testcase_03 AC 8 ms
32,136 KB
testcase_04 AC 8 ms
32,032 KB
testcase_05 AC 7 ms
32,024 KB
testcase_06 AC 7 ms
32,076 KB
testcase_07 AC 35 ms
32,388 KB
testcase_08 AC 35 ms
32,408 KB
testcase_09 AC 34 ms
32,492 KB
testcase_10 AC 34 ms
32,340 KB
testcase_11 AC 35 ms
32,352 KB
testcase_12 AC 318 ms
35,376 KB
testcase_13 AC 320 ms
35,384 KB
testcase_14 AC 324 ms
35,368 KB
testcase_15 AC 338 ms
35,652 KB
testcase_16 AC 318 ms
35,420 KB
testcase_17 AC 283 ms
35,364 KB
testcase_18 AC 267 ms
35,372 KB
testcase_19 AC 291 ms
35,364 KB
testcase_20 AC 299 ms
35,412 KB
testcase_21 AC 401 ms
35,380 KB
testcase_22 AC 404 ms
35,644 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

LL N;
LL A[100000];
LL P[40][100000];

int main() {
 cin>>N;
 rep(i,N){ cin>>A[i]; P[0][i]=A[i];}
 int Q; cin>>Q;
 rep(d,40)rep(i,N) P[d+1][i]=P[d][i]+P[d][(i+P[d][i])%N];
 while(Q--){
  LL K; cin>>K;
  LL x=0;
  rep(d,40) if((K>>d)&1) x+=P[d][x%N];
  cout<<x<<endl;
 }
 return 0;
}
0