結果

問題 No.182 新規性の虜
ユーザー h_noson
提出日時 2016-02-12 23:16:26
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 46 ms / 5,000 ms
コード長 599 bytes
コンパイル時間 2,501 ms
コンパイル使用メモリ 63,092 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-27 00:43:00
合計ジャッジ時間 2,445 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <queue>
using namespace std;

int main(){
    int n;
    priority_queue<int> as;
    cin >> n;
    for (int i = 0; i < n; i++){
        int a;
        cin >> a;
        as.push(a);
    }
    int prev = -1;
    int ans = 0;
    int cnt = 0;
    for (int i = 0; i < n; i++){
        if (prev == as.top()){
            cnt++;
        }
        else {
            if (cnt == 1){
                ans++;
            }
            prev = as.top();
            cnt = 1;
        }
        as.pop();
    }
    if (cnt == 1)
        ans++;
    cout << ans << endl;
    return 0;
}
0