結果

問題 No.1268 Fruit Rush 2
ユーザー publflpublfl
提出日時 2020-10-23 23:17:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 206 ms / 2,000 ms
コード長 369 bytes
コンパイル時間 824 ms
コンパイル使用メモリ 61,904 KB
実行使用メモリ 29,668 KB
最終ジャッジ日時 2023-09-28 18:29:00
合計ジャッジ時間 6,178 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 134 ms
16,092 KB
testcase_17 AC 114 ms
15,092 KB
testcase_18 AC 121 ms
15,464 KB
testcase_19 AC 118 ms
15,412 KB
testcase_20 AC 118 ms
15,360 KB
testcase_21 AC 115 ms
15,176 KB
testcase_22 AC 136 ms
16,096 KB
testcase_23 AC 134 ms
16,064 KB
testcase_24 AC 119 ms
15,456 KB
testcase_25 AC 117 ms
15,280 KB
testcase_26 AC 206 ms
29,668 KB
testcase_27 AC 206 ms
29,596 KB
testcase_28 AC 205 ms
29,596 KB
testcase_29 AC 205 ms
29,656 KB
testcase_30 AC 206 ms
29,652 KB
testcase_31 AC 192 ms
17,176 KB
testcase_32 AC 192 ms
17,168 KB
testcase_33 AC 193 ms
17,160 KB
testcase_34 AC 147 ms
17,160 KB
testcase_35 AC 164 ms
17,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <algorithm>
#include <map>

std::map<long long int,int> M;
long long int x[200010];
int main()
{
	int a;
	scanf("%d",&a);
	for(int i=1;i<=a;i++) scanf("%lld",&x[i]);
	std::sort(x+1,x+a+1);
	
	long long int ans = 0;
	for(int i=a;i>=1;i--)
	{
		if(M.find(x[i]+1)!=M.end()) ans += M[x[i]+1];
		M[x[i]] = M[x[i]+2]+1;
	}
	printf("%lld",ans+a);
}
0