結果

問題 No.8084 ゲームブックにトライ!
ユーザー 1_no_se
提出日時 2021-03-30 00:40:31
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 560 bytes
コンパイル時間 691 ms
コンパイル使用メモリ 63,104 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2024-11-29 19:52:01
合計ジャッジ時間 30,247 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 25 TLE * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <iostream>
typedef long long ll;
using namespace std;

constexpr ll mod007 = 1000000007;
//constexpr ll mod998 = 998244353;

constexpr int mod998 = 998244353;

int N, A[100000];
ll res;

int main() {
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d", &A[i]);
		if (A[i] >= mod998)A[i] -= mod998;
	}
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			res += A[i] + A[j];
			if (A[i] + A[j] >= mod998)res -= mod998;
		}
	}
	printf("%lld\n", res);
}
0