結果

問題 No.1097 Remainder Operation
ユーザー auaua
提出日時 2020-06-26 22:19:27
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,057 bytes
コンパイル時間 1,531 ms
コンパイル使用メモリ 171,808 KB
実行使用メモリ 54,912 KB
最終ジャッジ日時 2024-07-04 22:01:21
合計ジャッジ時間 6,551 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1 RE * 1
other WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define double long double
#define endl '\n'
typedef unsigned long long ll;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=1e9+7;
signed main(){
    ll n;cin>>n;
    vector<ll>a(n);
    rep(i,n)cin>>a[i];
    vector<vector<ll> >dp(n,vector<ll>(60));
    rep(j,60LL){
        rep(i,n){
            if(j==0)dp[i][j]=(a[i]);
            else{
                ll s=(dp[i][j-1]%n)%n;
                s=(s+i)%n;
                dp[i][j]=dp[s][j-1]+dp[i][j-1];
            }
        }
    }
    rep(i,5){
        cout<<dp[3][i]<<endl;
    }
    ll q;cin>>q;
    rep(i,q){
        ll k;cin>>k;
        ll ans=0;
        ll now=0;
        rep(j,60LL){
            if((1LL<<j)&k){
                now=ans%n;
                ans=ans+dp[now][j];
            }
        }
        //cout<<ans<<endl;
    }
}
0