Submission #63787005


Source Code Expand

Copy
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define debug() cout<<"come on"<<'\n'
#define mkp make_pair
#define pb push_back
#define ft first
#define sd second
typedef pair<int,int> pii;
typedef pair<int,pii> piii;
int n,ans,res,a[300005];
map<int,int> mp1,mp2;
signed main(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
mp1[a[i]]++;
}
res=mp1.size(),ans=res;
for(int i=1;i<=n;i++){
mp2[a[i]]++,mp1[a[i]]--;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define debug() cout<<"come on"<<'\n'
#define mkp make_pair
#define pb push_back
#define ft first
#define sd second
typedef pair<int,int> pii;
typedef pair<int,pii> piii;
int n,ans,res,a[300005];
map<int,int> mp1,mp2;
signed main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		mp1[a[i]]++;
	}
	res=mp1.size(),ans=res;
	for(int i=1;i<=n;i++){
		mp2[a[i]]++,mp1[a[i]]--;
		if(mp2[a[i]]==1)res++;
		if(mp1[a[i]]==0)res--;
		ans=max(ans,res);
	}
	cout<<ans;
	return 0;
}

Submission Info

Submission Time
Task C - Variety Split Easy
User dulf2024
Language C++ 20 (gcc 12.2)
Score 350
Code Size 566 Byte
Status AC
Exec Time 763 ms
Memory 43420 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 350 / 350
Status
AC × 2
AC × 38
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_01.txt, 01_test_00.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt, 01_test_22.txt, 01_test_23.txt, 01_test_24.txt, 01_test_25.txt, 01_test_26.txt, 01_test_27.txt, 01_test_28.txt, 01_test_29.txt, 01_test_30.txt, 01_test_31.txt, 01_test_32.txt, 01_test_33.txt, 01_test_34.txt, 01_test_35.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3660 KB
00_sample_01.txt AC 1 ms 3572 KB
01_test_00.txt AC 1 ms 3528 KB
01_test_01.txt AC 2 ms 3544 KB
01_test_02.txt AC 1 ms 3504 KB
01_test_03.txt AC 1 ms 3724 KB
01_test_04.txt AC 2 ms 3548 KB
01_test_05.txt AC 108 ms 10648 KB
01_test_06.txt AC 642 ms 29492 KB
01_test_07.txt AC 150 ms 12596 KB
01_test_08.txt AC 626 ms 29520 KB
01_test_09.txt AC 517 ms 26704 KB
01_test_10.txt AC 648 ms 29516 KB
01_test_11.txt AC 102 ms 10440 KB
01_test_12.txt AC 652 ms 29452 KB
01_test_13.txt AC 49 ms 7552 KB
01_test_14.txt AC 642 ms 29496 KB
01_test_15.txt AC 384 ms 12200 KB
01_test_16.txt AC 541 ms 17668 KB
01_test_17.txt AC 602 ms 22060 KB
01_test_18.txt AC 600 ms 25412 KB
01_test_19.txt AC 632 ms 27608 KB
01_test_20.txt AC 29 ms 5716 KB
01_test_21.txt AC 56 ms 5988 KB
01_test_22.txt AC 57 ms 5840 KB
01_test_23.txt AC 57 ms 5988 KB
01_test_24.txt AC 56 ms 5836 KB
01_test_25.txt AC 289 ms 43352 KB
01_test_26.txt AC 763 ms 43304 KB
01_test_27.txt AC 1 ms 3500 KB
01_test_28.txt AC 1 ms 3452 KB
01_test_29.txt AC 251 ms 29728 KB
01_test_30.txt AC 133 ms 10076 KB
01_test_31.txt AC 105 ms 7340 KB
01_test_32.txt AC 279 ms 43308 KB
01_test_33.txt AC 279 ms 43296 KB
01_test_34.txt AC 279 ms 43280 KB
01_test_35.txt AC 275 ms 43420 KB


2025-03-30 (Sun)
08:24:46 +00:00