結果

問題 No.510 二次漸化式
ユーザー latte0119latte0119
提出日時 2017-04-28 23:03:36
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 967 bytes
コンパイル時間 2,648 ms
コンパイル使用メモリ 196,824 KB
実行使用メモリ 8,700 KB
最終ジャッジ日時 2023-10-11 19:41:22
合計ジャッジ時間 48,605 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,700 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 40 ms
4,348 KB
testcase_03 AC 39 ms
4,352 KB
testcase_04 AC 40 ms
4,348 KB
testcase_05 AC 40 ms
4,352 KB
testcase_06 AC 335 ms
4,352 KB
testcase_07 AC 339 ms
4,348 KB
testcase_08 AC 341 ms
4,352 KB
testcase_09 AC 342 ms
4,348 KB
testcase_10 AC 7 ms
4,348 KB
testcase_11 AC 6 ms
4,348 KB
testcase_12 AC 6 ms
4,348 KB
testcase_13 AC 6 ms
4,352 KB
testcase_14 AC 6 ms
4,348 KB
testcase_15 AC 6 ms
4,348 KB
testcase_16 AC 1,698 ms
5,096 KB
testcase_17 AC 1,669 ms
5,100 KB
testcase_18 AC 1,669 ms
5,104 KB
testcase_19 AC 1,677 ms
5,144 KB
testcase_20 AC 1,679 ms
5,120 KB
testcase_21 AC 1,672 ms
5,120 KB
testcase_22 AC 1,668 ms
5,084 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 TLE -
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 AC 8 ms
4,348 KB
testcase_32 AC 8 ms
4,384 KB
testcase_33 AC 8 ms
5,152 KB
testcase_34 TLE -
testcase_35 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int N,Q;
int X[111111],Y[111111];

const int mod=1000000007;

signed main(){
    scanf("%lld%lld",&N,&Q);

    rep(i,Q){
        char c;
        int k;
        scanf(" %c%lld",&c,&k);
        if(c=='x'){
            scanf("%lld",&X[k]);
        }
        else if(c=='y'){
            scanf("%lld",&Y[k]);
        }
        else{
            int a=1,b=1;
            for(int j=0;j<k;j++){
                a=(X[j]*b%mod*b+a)%mod;
                b=(Y[j]*b+1)%mod;
            }
            printf("%lld\n",a);
        }
    }
    return 0;
}
0