結果

問題 No.2036 Max Middle
ユーザー 👑 ygussanyygussany
提出日時 2022-08-12 21:40:36
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 292 bytes
コンパイル時間 1,630 ms
コンパイル使用メモリ 28,856 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 08:56:12
合計ジャッジ時間 2,469 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 17 ms
4,348 KB
testcase_09 AC 28 ms
4,348 KB
testcase_10 AC 29 ms
4,348 KB
testcase_11 AC 26 ms
4,348 KB
testcase_12 AC 23 ms
4,348 KB
testcase_13 AC 30 ms
4,348 KB
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 28 ms
4,348 KB
testcase_17 AC 20 ms
4,348 KB
testcase_18 AC 23 ms
4,348 KB
testcase_19 AC 24 ms
4,348 KB
testcase_20 AC 26 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main()
{
	int i, N, A[200001];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%d", &(A[i]));
	
	int tmp = 0;
	long long ans = 0;
	for (i = N - 1; i >= 1; i--) {
		if (A[i] > A[i+1]) tmp++;
		else ans += tmp;
	}
	printf("%lld\n", ans);
	fflush(stdout);
	return 0;
}
0