提出 #63804472
ソースコード 拡げる
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include<bits/stdc++.h>
using namespace std;
int main(){
int i,j,ans,cans,N,A[300005],F[300005],L[300005],Ans[300005];
set<int> st;
set<int> stl;
cin>>N;
for(i=0;i<N;i++){
cin>>A[i];
}
for(i=0;i<N;i++){
if(st.find(A[i])==st.end()){
st.insert(A[i]);
F[i]=F[i-1]+1;
}else{
F[i]=F[i-1];
}
// cout<<F[i]<<endl;
}
for(i=N-1;i>=0;i--){
if(stl.find(A[i])==stl.end()){
stl.insert(A[i]);
L[i]=L[i+1]+1;
}else{
L[i]=L[i+1];
}
//cout<<L[i]<<endl;
}
ans=0;
for(i=0;i<N-1;i++){
Ans[i]=F[i]+L[i+1];
ans=max(ans,Ans[i]);
}
cout<<ans;
return 0;
}
提出情報
コンパイルエラー
Main.cpp: In function ‘int main()’:
Main.cpp:6:9: warning: unused variable ‘j’ [-Wunused-variable]
6 | int i,j,ans,cans,N,A[300005],F[300005],L[300005],Ans[300005];
| ^
Main.cpp:6:15: warning: unused variable ‘cans’ [-Wunused-variable]
6 | int i,j,ans,cans,N,A[300005],F[300005],L[300005],Ans[300005];
| ^~~~
ジャッジ結果
セット名 |
Sample |
All |
得点 / 配点 |
0 / 0 |
350 / 350 |
結果 |
|
|
セット名 |
テストケース |
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 |
ケース名 |
結果 |
実行時間 |
メモリ |
00_sample_00.txt |
AC |
2 ms |
7036 KB |
00_sample_01.txt |
AC |
2 ms |
6996 KB |
01_test_00.txt |
AC |
2 ms |
7036 KB |
01_test_01.txt |
AC |
2 ms |
7008 KB |
01_test_02.txt |
AC |
2 ms |
7000 KB |
01_test_03.txt |
AC |
2 ms |
7044 KB |
01_test_04.txt |
AC |
2 ms |
7052 KB |
01_test_05.txt |
AC |
48 ms |
11872 KB |
01_test_06.txt |
AC |
223 ms |
24824 KB |
01_test_07.txt |
AC |
65 ms |
13324 KB |
01_test_08.txt |
AC |
224 ms |
24980 KB |
01_test_09.txt |
AC |
194 ms |
22784 KB |
01_test_10.txt |
AC |
222 ms |
24792 KB |
01_test_11.txt |
AC |
46 ms |
11648 KB |
01_test_12.txt |
AC |
223 ms |
24840 KB |
01_test_13.txt |
AC |
26 ms |
9828 KB |
01_test_14.txt |
AC |
222 ms |
24772 KB |
01_test_15.txt |
AC |
147 ms |
11716 KB |
01_test_16.txt |
AC |
177 ms |
15888 KB |
01_test_17.txt |
AC |
196 ms |
19212 KB |
01_test_18.txt |
AC |
210 ms |
21536 KB |
01_test_19.txt |
AC |
216 ms |
23368 KB |
01_test_20.txt |
AC |
27 ms |
7040 KB |
01_test_21.txt |
AC |
54 ms |
7000 KB |
01_test_22.txt |
AC |
55 ms |
7104 KB |
01_test_23.txt |
AC |
55 ms |
6980 KB |
01_test_24.txt |
AC |
55 ms |
6996 KB |
01_test_25.txt |
AC |
228 ms |
35164 KB |
01_test_26.txt |
AC |
274 ms |
35040 KB |
01_test_27.txt |
AC |
2 ms |
7036 KB |
01_test_28.txt |
AC |
2 ms |
6996 KB |
01_test_29.txt |
AC |
175 ms |
24780 KB |
01_test_30.txt |
AC |
78 ms |
10040 KB |
01_test_31.txt |
AC |
59 ms |
8120 KB |
01_test_32.txt |
AC |
226 ms |
35312 KB |
01_test_33.txt |
AC |
227 ms |
35164 KB |
01_test_34.txt |
AC |
226 ms |
35184 KB |
01_test_35.txt |
AC |
226 ms |
35252 KB |