結果

問題 No.2036 Max Middle
ユーザー publfl2publfl2
提出日時 2022-08-12 21:59:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 339 bytes
コンパイル時間 402 ms
コンパイル使用メモリ 47,008 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 09:56:40
合計ジャッジ時間 1,676 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>
#include <set>

int x[200010];
std::set< std::pair<int,int> > S;
int main()
{
	long long int ans = 0;
	int p = 0;
	int a;
	scanf("%d",&a);
	for(int i=1;i<=a;i++) scanf("%d",&x[i]);
	for(int i=1;i<a;i++)
	{
		int val;
		if(x[i]<x[i+1]) val = 0;
		else val = 1;
		if(val==0) p++;
		else ans += p;
	}
	printf("%lld",ans);
}
0