結果

問題 No.2600 Avator Height
ユーザー Today03Today03
提出日時 2024-01-13 17:59:33
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 383 ms / 2,000 ms
コード長 727 bytes
コンパイル時間 2,045 ms
コンパイル使用メモリ 202,168 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-01-13 17:59:48
合計ジャッジ時間 13,888 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
11,136 KB
testcase_01 AC 353 ms
10,752 KB
testcase_02 AC 383 ms
9,344 KB
testcase_03 AC 354 ms
8,832 KB
testcase_04 AC 374 ms
8,448 KB
testcase_05 AC 343 ms
7,168 KB
testcase_06 AC 353 ms
7,808 KB
testcase_07 AC 345 ms
8,320 KB
testcase_08 AC 354 ms
9,216 KB
testcase_09 AC 373 ms
9,472 KB
testcase_10 AC 353 ms
9,472 KB
testcase_11 AC 378 ms
7,424 KB
testcase_12 AC 353 ms
10,624 KB
testcase_13 AC 378 ms
9,088 KB
testcase_14 AC 351 ms
8,320 KB
testcase_15 AC 356 ms
7,808 KB
testcase_16 AC 348 ms
8,960 KB
testcase_17 AC 344 ms
7,168 KB
testcase_18 AC 378 ms
6,912 KB
testcase_19 AC 350 ms
7,808 KB
testcase_20 AC 374 ms
7,168 KB
testcase_21 AC 347 ms
9,984 KB
testcase_22 AC 368 ms
7,936 KB
testcase_23 AC 346 ms
10,368 KB
testcase_24 AC 310 ms
6,676 KB
testcase_25 AC 344 ms
11,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#ifdef LOCAL
#include "./debug.cpp"
#else
#define debug(...)
#define print_line
#endif
using namespace std;
using ll = long long;

int mod = 998244353;
vector<int> memo1(200001, -1), memo2(200001, -1);
int R(int i) {
	if (memo1[i] != -1) return memo1[i];
	if (i == 1) return 1;
	if (i == 2) return 1;
	memo1[i] = (R(i - 1) + R(i - 2)) % mod;
	return memo1[i];
}
int E(int i) {
	if (memo2[i] != -1) return memo2[i];
	if (i == 1) return 1;
	if (i == 2) return 3;
	memo2[i] = (E(i - 1) + E(i - 2)) % mod;
	return memo2[i];
}

int main() {
	int Q;
	cin >> Q;
	while (Q--) {
		int N;
		cin >> N;
		ll r = 1ll * R(N) * R(N) * 5 % mod, e = 1ll * E(N) * E(N) % mod;
		cout << (r - e + mod) % mod << '\n';
	}
}
0