結果

問題 No.2600 Avator Height
ユーザー 👑 amentorimaruamentorimaru
提出日時 2023-12-05 01:59:29
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 681 ms / 2,000 ms
コード長 809 bytes
コンパイル時間 4,763 ms
コンパイル使用メモリ 182,520 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-05 02:40:59
合計ジャッジ時間 28,997 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 658 ms
6,676 KB
testcase_02 AC 660 ms
6,676 KB
testcase_03 AC 656 ms
6,676 KB
testcase_04 AC 653 ms
6,676 KB
testcase_05 AC 674 ms
6,676 KB
testcase_06 AC 661 ms
6,676 KB
testcase_07 AC 660 ms
6,676 KB
testcase_08 AC 658 ms
6,676 KB
testcase_09 AC 658 ms
6,676 KB
testcase_10 AC 659 ms
6,676 KB
testcase_11 AC 673 ms
6,676 KB
testcase_12 AC 655 ms
6,676 KB
testcase_13 AC 668 ms
6,676 KB
testcase_14 AC 657 ms
6,676 KB
testcase_15 AC 654 ms
6,676 KB
testcase_16 AC 655 ms
6,676 KB
testcase_17 AC 657 ms
6,676 KB
testcase_18 AC 656 ms
6,676 KB
testcase_19 AC 657 ms
6,676 KB
testcase_20 AC 659 ms
6,676 KB
testcase_21 AC 661 ms
6,676 KB
testcase_22 AC 663 ms
6,676 KB
testcase_23 AC 665 ms
6,676 KB
testcase_24 AC 661 ms
6,676 KB
testcase_25 AC 659 ms
6,676 KB
testcase_26 AC 664 ms
6,676 KB
testcase_27 AC 656 ms
6,676 KB
testcase_28 AC 659 ms
6,676 KB
testcase_29 AC 659 ms
6,676 KB
testcase_30 AC 657 ms
6,676 KB
testcase_31 AC 299 ms
6,676 KB
testcase_32 AC 681 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
using mint = modint998244353;

vector<mint> mul(vector<mint>& a, vector<mint>& b) {
	vector<mint> res = { a[0] * b[0] + a[1] * b[2],a[0] * b[1] + a[1] * b[3],a[2] * b[0] + a[3] * b[2],a[2] * b[1] + a[3] * b[3] };
	return res;
}

vector<mint> power(long long n, vector<mint>& mut) {
	vector<mint> res = { 1,0,0,1 };
	if (n == 0)
		return res;
	auto pow = mul(mut, mut);
	res = power(n / 2, pow);
	if (n % 2)res = mul(res, mut);
	return res;
}

int main() {
	int q;
	cin >> q;
	vector<mint> mut = { 0,1,1,1 };
	for(int i=0; i<q; i++){
		int n;
		cin>>n;
		auto res = power(n - 1, mut);
		cout << (5 * (res[0] + res[1]) * (res[0] + res[1]) - (res[0] + 3 * res[1]) * (res[0] + 3 * res[1])).val() << "\n";
	}
}
0