結果

問題 No.3009 異なる数字の最大の範囲(勉強会用)
ユーザー 小指が強い人小指が強い人
提出日時 2016-01-20 20:08:52
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 484 bytes
コンパイル時間 1,476 ms
コンパイル使用メモリ 70,704 KB
実行使用メモリ 8,100 KB
最終ジャッジ日時 2023-09-03 16:53:00
合計ジャッジ時間 2,788 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 WA -
testcase_06 AC 2 ms
4,380 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 41 ms
8,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0