結果

問題 No.182 新規性の虜
ユーザー trineutron
提出日時 2020-04-09 16:36:26
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 51 ms / 5,000 ms
コード長 415 bytes
コンパイル時間 3,811 ms
コンパイル使用メモリ 196,244 KB
最終ジャッジ日時 2025-01-09 15:28:40
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a.at(i);
    sort(a.begin(), a.end());
    int ans = 0, d = 1;
    for (int i = 1; i < n; i++) {
        if (a.at(i) == a.at(i - 1)) {
            d = 0;
        } else {
            ans += d;
            d = 1;
        }
    }
    ans += d;
    cout << ans << endl;
}
0