結果
| 問題 | No.510 二次漸化式 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-02-24 17:08:33 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,213 bytes |
| 記録 | |
| コンパイル時間 | 1,639 ms |
| コンパイル使用メモリ | 163,264 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2025-02-24 17:09:02 |
| 合計ジャッジ時間 | 27,679 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 33 TLE * 1 |
ソースコード
#include<bits/stdc++.h>
#define ls(k) k << 1
#define rs(k) k << 1 | 1
#define fi first
#define se second
#define open(s1, s2) freopen(s1, "r", stdin), freopen(s2, "w", stdout);
using namespace std;
typedef __int128 __;
typedef long double lb;
typedef double db;
typedef unsigned long long ull;
typedef long long ll;
bool Begin;
inline ll read(){
ll x = 0, f = 1;
char c = getchar();
while(c < '0' || c > '9'){
if(c == '-')
f = -1;
c = getchar();
}
while(c >= '0' && c <= '9'){
x = (x << 1) + (x << 3) + (c ^ 48);
c = getchar();
}
return x * f;
}
inline void write(ll x){
if(x < 0){
putchar('-');
x = -x;
}
if(x > 9)
write(x / 10);
putchar(x % 10 + '0');
}
int N,Q;
ll X[101010];
ll Y[101010];
ll mo=1000000007;
void solve() {
int i,j,k,l,r,x,y; string s;
cin>>N>>Q;
while(Q--) {
cin>>s>>x;
if(s=="x") cin>>X[x];
else if(s=="y") cin>>Y[x];
else if(s=="a") {
ll A=1,B=1;
for(int i = 0; i < x; ++i){
if(X[i]) (A += X[i]*B%mo*B)%=mo;
if(Y[i]) B = (B*Y[i]+1)%mo;
else B=1;
}
cout<<A<<endl;
}
}
}
bool End;
int main(){
solve();
cerr << '\n' << abs(&Begin - &End) / 1048576 << "MB";
return 0;
}