結果
問題 | No.1097 Remainder Operation |
ユーザー |
👑 ![]() |
提出日時 | 2020-10-04 13:11:35 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 346 ms / 2,000 ms |
コード長 | 424 bytes |
コンパイル時間 | 1,389 ms |
コンパイル使用メモリ | 165,976 KB |
実行使用メモリ | 35,584 KB |
最終ジャッジ日時 | 2024-07-19 09:08:44 |
合計ジャッジ時間 | 7,958 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 |
ソースコード
#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;}