結果

問題 No.510 二次漸化式
ユーザー ldsybldsyb
提出日時 2017-04-29 00:52:58
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 694 bytes
コンパイル時間 713 ms
コンパイル使用メモリ 68,256 KB
実行使用メモリ 6,804 KB
最終ジャッジ日時 2023-10-11 20:08:49
合計ジャッジ時間 37,905 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 52 ms
4,352 KB
testcase_03 AC 53 ms
4,348 KB
testcase_04 AC 39 ms
4,348 KB
testcase_05 AC 38 ms
4,352 KB
testcase_06 AC 228 ms
4,352 KB
testcase_07 AC 227 ms
4,352 KB
testcase_08 AC 355 ms
4,352 KB
testcase_09 AC 358 ms
4,348 KB
testcase_10 AC 18 ms
4,352 KB
testcase_11 AC 18 ms
4,352 KB
testcase_12 AC 17 ms
4,352 KB
testcase_13 AC 17 ms
4,348 KB
testcase_14 AC 18 ms
4,348 KB
testcase_15 AC 17 ms
4,352 KB
testcase_16 AC 1,758 ms
6,556 KB
testcase_17 AC 1,033 ms
6,560 KB
testcase_18 AC 1,055 ms
6,688 KB
testcase_19 AC 1,066 ms
6,536 KB
testcase_20 AC 1,719 ms
6,616 KB
testcase_21 AC 1,723 ms
6,568 KB
testcase_22 AC 1,737 ms
6,516 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 TLE -
testcase_28 AC 2,118 ms
6,748 KB
testcase_29 AC 2,098 ms
6,556 KB
testcase_30 AC 2,078 ms
6,532 KB
testcase_31 AC 8 ms
5,760 KB
testcase_32 AC 9 ms
5,764 KB
testcase_33 AC 8 ms
6,512 KB
testcase_34 AC 32 ms
5,136 KB
testcase_35 AC 31 ms
5,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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);
		}
	}
}
0