結果

問題 No.1097 Remainder Operation
ユーザー auauaauaua
提出日時 2020-06-26 22:19:27
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,057 bytes
コンパイル時間 1,732 ms
コンパイル使用メモリ 169,936 KB
実行使用メモリ 55,028 KB
最終ジャッジ日時 2023-09-18 05:36:07
合計ジャッジ時間 5,499 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 RE -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

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