結果
問題 | No.510 二次漸化式 |
ユーザー |
![]() |
提出日時 | 2017-04-29 00:52:58 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 694 bytes |
コンパイル時間 | 777 ms |
コンパイル使用メモリ | 69,228 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-13 18:58:46 |
合計ジャッジ時間 | 37,690 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 29 TLE * 5 |
ソースコード
#pragma GCC optimize ("O3") #pragma GCC target ("avx") #include <iostream> using namespace std; using ll = long long; ll a[100001], b[100001], x[100001], y[100001]; int main(){ constexpr ll mod = 1e9 + 7; cin.tie(0); ios::sync_with_stdio(false); char c; ll n, q, i, v, puni = 0; cin >> n >> q; a[0] = b[0] = 1; for(ll p = 0; p < q; p++){ cin >> c; if(c == 'a'){ if(puni != 10000000){ for(ll j = puni; j < n; j++){ a[j + 1] = (x[j] * b[j] % mod * b[j] + a[j]) % mod; b[j + 1] = (y[j] * b[j] + 1) % mod; } puni = 10000000; } cin >> i; cout << a[i] << endl; }else{ cin >> i >> v; (c == 'x' ? x : y)[i] = v; puni = min(puni, i); } } }