Submission #63788084
Source Code Expand
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <vector>
#include <queue>
#include <cstdlib>
#include <cstring>
#include <cstdint>
#include <functional>
#include <stack>
#include <map>
#include <random>
#include <ctime>
#include <unordered_set>
#include <unordered_map>
#include <set>
#include <map>
typedef long long LL;
typedef std::pair<int,int> PII;
typedef std::pair<LL,LL> PLL;
typedef unsigned long long ull;
#define rep(i,l,r) for(auto i(l);i<=(r);++i)
#define per(i,r,l) for(auto i(r);i>=(l);--i)
#define rpp(i,l,r) for(auto i(l);i<(r);++i)
#define ppr(i,r,l) for(auto i(r);i>(l);--i)
#define lowbit(x) ((x)&-(x))
#define ls(p) ((p)<<1)
#define rs(p) ((p)<<1|1)
template<typename T>inline T min(T a,T b){return a<b?a:b;}
template<typename T>inline T max(T a,T b){return a>b?a:b;}
const int N = 400010;
const int M = 1000010;
const int mod = 1000000007;
const auto INF = 0x3f3f3f3f;
int n;
int a[N];
int cnt1[N],cnt2[N];
int ans,num;
int main(){
scanf("%d",&n);
rep(i,1,n){scanf("%d",&a[i]);num+=(!cnt2[a[i]]);++cnt2[a[i]];}
int p=n;
while(p>1){
--cnt2[a[p]];
num-=(!cnt2[a[p]]);
num+=(!cnt1[a[p]]);
++cnt1[a[p]];
--p;
ans=max(ans,num);
}
printf("%d\n",ans);
return 0;
}
/*
-std=c++14
-Wall -O2 -static
-Wall -O2 -fsanitize=address,undefined
LHY qingchunkeai,shanliangdafang,wengrouxianhui,meilidongren,chenyuluoyan,biyuexiuhua.
Genshin Impact
LJ tql.
*/
Submission Info
Submission Time |
|
Task |
C - Variety Split Easy |
User |
Xr0805 |
Language |
C++ 20 (gcc 12.2) |
Score |
350 |
Code Size |
1568 Byte |
Status |
AC |
Exec Time |
31 ms |
Memory |
7424 KB |
Compile Error
Main.cpp: In function ‘int main()’:
Main.cpp:48:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
48 | scanf("%d",&n);
| ~~~~~^~~~~~~~~
Main.cpp:49:21: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
49 | rep(i,1,n){scanf("%d",&a[i]);num+=(!cnt2[a[i]]);++cnt2[a[i]];}
| ~~~~~^~~~~~~~~~~~
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
350 / 350 |
Status |
|
|
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 |
3788 KB |
00_sample_01.txt |
AC |
1 ms |
3676 KB |
01_test_00.txt |
AC |
1 ms |
3708 KB |
01_test_01.txt |
AC |
1 ms |
3868 KB |
01_test_02.txt |
AC |
1 ms |
3708 KB |
01_test_03.txt |
AC |
1 ms |
3604 KB |
01_test_04.txt |
AC |
1 ms |
3800 KB |
01_test_05.txt |
AC |
8 ms |
4828 KB |
01_test_06.txt |
AC |
30 ms |
7376 KB |
01_test_07.txt |
AC |
10 ms |
5108 KB |
01_test_08.txt |
AC |
30 ms |
7296 KB |
01_test_09.txt |
AC |
26 ms |
6940 KB |
01_test_10.txt |
AC |
31 ms |
7176 KB |
01_test_11.txt |
AC |
8 ms |
4716 KB |
01_test_12.txt |
AC |
30 ms |
7400 KB |
01_test_13.txt |
AC |
5 ms |
4360 KB |
01_test_14.txt |
AC |
31 ms |
7424 KB |
01_test_15.txt |
AC |
30 ms |
7320 KB |
01_test_16.txt |
AC |
29 ms |
7380 KB |
01_test_17.txt |
AC |
30 ms |
7220 KB |
01_test_18.txt |
AC |
30 ms |
7324 KB |
01_test_19.txt |
AC |
29 ms |
7176 KB |
01_test_20.txt |
AC |
15 ms |
4852 KB |
01_test_21.txt |
AC |
19 ms |
4848 KB |
01_test_22.txt |
AC |
19 ms |
4972 KB |
01_test_23.txt |
AC |
21 ms |
4960 KB |
01_test_24.txt |
AC |
20 ms |
4776 KB |
01_test_25.txt |
AC |
20 ms |
7368 KB |
01_test_26.txt |
AC |
30 ms |
7376 KB |
01_test_27.txt |
AC |
1 ms |
3916 KB |
01_test_28.txt |
AC |
1 ms |
3676 KB |
01_test_29.txt |
AC |
20 ms |
7424 KB |
01_test_30.txt |
AC |
18 ms |
5212 KB |
01_test_31.txt |
AC |
17 ms |
4988 KB |
01_test_32.txt |
AC |
20 ms |
7312 KB |
01_test_33.txt |
AC |
21 ms |
7240 KB |
01_test_34.txt |
AC |
20 ms |
7424 KB |
01_test_35.txt |
AC |
20 ms |
7288 KB |