結果
| 問題 |
No.8009 異なる数字の最大の範囲(勉強会用)
|
| ユーザー |
小指が強い人
|
| 提出日時 | 2016-01-20 20:08:52 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 484 bytes |
| コンパイル時間 | 721 ms |
| コンパイル使用メモリ | 69,620 KB |
| 実行使用メモリ | 8,332 KB |
| 最終ジャッジ日時 | 2024-06-12 22:30:47 |
| 合計ジャッジ時間 | 1,543 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 WA * 14 |
ソースコード
#include <iostream>
#include <unordered_map>
using namespace std;
int main(void)
{
unordered_map<int, bool> h;
int n;
int a[100000] = {0};
cin >> n;
for(int i = 0; i < n; i++)
cin>> a[i];
int res = 0;
for(int i = 0; i < n; i++) {
if(h.count(a[i]) == 0)
h[a[i]] = true;
else {
res = max(res, (int)h.size());
h.clear();
}
}
res = max(res, (int)h.size());
cout << res << endl;
}
小指が強い人