結果

問題 No.2556 Increasing Matrix
ユーザー hiro1729hiro1729
提出日時 2023-12-03 09:23:53
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 638 bytes
コンパイル時間 4,701 ms
コンパイル使用メモリ 262,176 KB
実行使用メモリ 10,772 KB
最終ジャッジ日時 2023-12-03 09:24:06
合計ジャッジ時間 12,698 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 4 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 3 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 10 ms
6,676 KB
testcase_14 AC 38 ms
6,676 KB
testcase_15 AC 31 ms
6,676 KB
testcase_16 AC 21 ms
6,676 KB
testcase_17 AC 49 ms
6,676 KB
testcase_18 TLE -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;

int main() {
	int N;
	scanf("%d", &N);
	int A[100000];
	for (int i = 0; i < N; i++) scanf("%d", &A[i]);
	long long inv[100000]; inv[1] = 1;
	long long invf = 1;
	long long ans = 1;
	for (int i = 2; i < N; i++) {
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		invf = invf * inv[i] % mod;
		ans = ans * invf % mod;
	}
	for (int j = 0; j < N; j++) {
		for (int i = j + 1; i < N; i++) {
			ans = ans * (A[i] - A[j] + i - j) % mod;
		}
	}
	printf("%d\n", ans * ans % mod);
}
0