提出 #65649018


ソースコード 拡げる

#include <iostream>
using namespace std;
int n, m, a[105], s[105], cnt, ans;
int main()
{
	cin >> n >> m;
	for(int i = 1; i <= n; i++) {
		cin >> a[i];
		s[a[i]]++;
		if (a[i] <= m && s[a[i]] == 1) cnt++;
	}
	for(int i = n; i >= 1; i--) {
		if (cnt < m) break;
		ans++;
		s[a[i]]--;
		if (a[i] <= m && s[a[i]] == 0) cnt--;
	}
	cout << ans << endl;
	return 0;
}

提出情報

提出日時
問題 B - Not All
ユーザ gobywind
言語 C++ 20 (gcc 12.2)
得点 200
コード長 379 Byte
結果 AC
実行時間 1 ms
メモリ 3652 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 3
AC × 20
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 02_random2_00.txt, 02_random2_01.txt, 02_random2_02.txt, 02_random2_03.txt, 02_random2_04.txt, 02_random2_05.txt, 02_random2_06.txt, 02_random2_07.txt, 03_handmade_00.txt, 03_handmade_01.txt, 03_handmade_02.txt, 03_handmade_03.txt, 03_handmade_04.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3648 KiB
00_sample_01.txt AC 1 ms 3508 KiB
00_sample_02.txt AC 1 ms 3488 KiB
01_random_00.txt AC 1 ms 3464 KiB
01_random_01.txt AC 1 ms 3492 KiB
01_random_02.txt AC 1 ms 3452 KiB
01_random_03.txt AC 1 ms 3440 KiB
02_random2_00.txt AC 1 ms 3652 KiB
02_random2_01.txt AC 1 ms 3368 KiB
02_random2_02.txt AC 1 ms 3492 KiB
02_random2_03.txt AC 1 ms 3648 KiB
02_random2_04.txt AC 1 ms 3560 KiB
02_random2_05.txt AC 1 ms 3396 KiB
02_random2_06.txt AC 1 ms 3444 KiB
02_random2_07.txt AC 1 ms 3440 KiB
03_handmade_00.txt AC 1 ms 3456 KiB
03_handmade_01.txt AC 1 ms 3452 KiB
03_handmade_02.txt AC 1 ms 3452 KiB
03_handmade_03.txt AC 1 ms 3576 KiB
03_handmade_04.txt AC 1 ms 3452 KiB