Submission #65639874


Source Code Expand

#include <bits/stdc++.h>
 
using namespace std;

const int MOD=1e9+7;


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
	int n,m;
	cin>>n>>m;
	int j=n;
	set<int> s;
	for(int i=0; i<n; i++){
		int x;
		cin>>x;
		s.insert(x);
		if(s.size()==m){
			j=i;
			break;
		}
		
	}
	cout<<n-j<<'\n'; 
	
	
    return 0;
}

Submission Info

Submission Time
Task B - Not All
User usernameson
Language C++ 20 (gcc 12.2)
Score 200
Code Size 358 Byte
Status AC
Exec Time 1 ms
Memory 3604 KiB

Compile Error

Main.cpp: In function ‘int main()’:
Main.cpp:20:28: warning: comparison of integer expressions of different signedness: ‘std::set<int>::size_type’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
   20 |                 if(s.size()==m){
      |                    ~~~~~~~~^~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 20
Set Name Test Cases
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
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3464 KiB
00_sample_01.txt AC 1 ms 3604 KiB
00_sample_02.txt AC 1 ms 3468 KiB
01_random_00.txt AC 1 ms 3472 KiB
01_random_01.txt AC 1 ms 3340 KiB
01_random_02.txt AC 1 ms 3476 KiB
01_random_03.txt AC 1 ms 3548 KiB
02_random2_00.txt AC 1 ms 3472 KiB
02_random2_01.txt AC 1 ms 3420 KiB
02_random2_02.txt AC 1 ms 3580 KiB
02_random2_03.txt AC 1 ms 3416 KiB
02_random2_04.txt AC 1 ms 3480 KiB
02_random2_05.txt AC 1 ms 3480 KiB
02_random2_06.txt AC 1 ms 3468 KiB
02_random2_07.txt AC 1 ms 3376 KiB
03_handmade_00.txt AC 1 ms 3532 KiB
03_handmade_01.txt AC 1 ms 3600 KiB
03_handmade_02.txt AC 1 ms 3412 KiB
03_handmade_03.txt AC 1 ms 3420 KiB
03_handmade_04.txt AC 1 ms 3540 KiB