結果
| 問題 |
No.8009 異なる数字の最大の範囲(勉強会用)
|
| ユーザー |
|
| 提出日時 | 2020-03-09 06:56:23 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 44 ms / 5,000 ms |
| コード長 | 296 bytes |
| コンパイル時間 | 555 ms |
| コンパイル使用メモリ | 66,628 KB |
| 実行使用メモリ | 7,808 KB |
| 最終ジャッジ日時 | 2024-11-20 15:01:32 |
| 合計ジャッジ時間 | 1,658 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
コンパイルメッセージ
main.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
8 | main()
| ^~~~
ソースコード
#include<iostream>
#include<algorithm>
using namespace std;
int N;
int cnt[1<<20];
int A[1<<17];
int ans;
main()
{
cin>>N;
int l=0,nc=0;
for(int i=0;i<N;i++)
{
cin>>A[i];
while(cnt[A[i]])
{
cnt[A[l++]]--;
nc--;
}
nc++;
cnt[A[i]]++;
ans=max(ans,nc);
}
cout<<ans<<endl;
}