結果
問題 | No.510 二次漸化式 |
ユーザー |
![]() |
提出日時 | 2017-04-28 23:03:36 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 967 bytes |
コンパイル時間 | 2,029 ms |
コンパイル使用メモリ | 191,696 KB |
最終ジャッジ日時 | 2025-01-03 22:20:34 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 24 TLE * 10 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:24:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 24 | scanf("%lld%lld",&N,&Q); | ~~~~~^~~~~~~~~~~~~~~~~~ main.cpp:29:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 29 | scanf(" %c%lld",&c,&k); | ~~~~~^~~~~~~~~~~~~~~~~ main.cpp:31:18: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 31 | scanf("%lld",&X[k]); | ~~~~~^~~~~~~~~~~~~~ main.cpp:34:18: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 34 | scanf("%lld",&Y[k]); | ~~~~~^~~~~~~~~~~~~~
ソースコード
#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 secondtypedef 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;}