結果

問題 No.1053 ゲーミング棒
ユーザー kriiikriii
提出日時 2020-05-15 21:26:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 692 bytes
コンパイル時間 524 ms
コンパイル使用メモリ 57,256 KB
実行使用メモリ 30,156 KB
最終ジャッジ日時 2023-10-19 13:05:50
合計ジャッジ時間 2,210 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
26,644 KB
testcase_01 AC 9 ms
26,592 KB
testcase_02 AC 11 ms
26,644 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 10 ms
26,644 KB
testcase_06 AC 10 ms
26,644 KB
testcase_07 AC 10 ms
26,644 KB
testcase_08 AC 10 ms
26,644 KB
testcase_09 AC 10 ms
26,644 KB
testcase_10 AC 10 ms
26,644 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 10 ms
26,644 KB
testcase_14 AC 10 ms
26,592 KB
testcase_15 AC 10 ms
26,644 KB
testcase_16 AC 11 ms
26,592 KB
testcase_17 AC 9 ms
26,644 KB
testcase_18 AC 9 ms
26,644 KB
testcase_19 AC 9 ms
26,644 KB
testcase_20 AC 9 ms
26,592 KB
testcase_21 AC 9 ms
26,592 KB
testcase_22 AC 9 ms
26,644 KB
testcase_23 AC 28 ms
30,104 KB
testcase_24 AC 34 ms
30,104 KB
testcase_25 AC 34 ms
30,156 KB
testcase_26 WA -
testcase_27 AC 10 ms
26,644 KB
testcase_28 AC 10 ms
26,592 KB
testcase_29 AC 10 ms
26,592 KB
testcase_30 AC 20 ms
27,152 KB
testcase_31 AC 22 ms
27,152 KB
testcase_32 AC 21 ms
27,152 KB
testcase_33 AC 22 ms
27,152 KB
testcase_34 AC 22 ms
27,152 KB
testcase_35 AC 23 ms
27,240 KB
testcase_36 AC 24 ms
27,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;

vector<int> wow[1001001];
int N, A[100100];

int main()
{
	scanf ("%d", &N);
	for (int i = 0; i < N; i++){
		scanf ("%d", &A[i]);
		wow[A[i]].push_back(i);
	}
	bool g = 1; int r = 0;
	for (int i = 1; i <= N; i++) if (!wow[i].empty()){
		sort(wow[i].begin(), wow[i].end());
		if (wow[i].size() == wow[i].back() - wow[i][0] + 1) continue;
		bool e = 0;
		for (int j = 1; j < wow[i].size(); j++){
			if (wow[i].size() == (wow[i][j - 1] - wow[i][0] + 1) + (wow[i].back() - wow[i][j] + 1)) e = 1;
		}
		if (!e) g = 0;
		else r++;
	}
	if (!g || r > 1) puts("-1");
	else if (r) puts("1");
	else puts("0");

	return 0;
}
0