結果

問題 No.182 新規性の虜
ユーザー not_522not_522
提出日時 2015-07-15 01:16:20
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 48 ms / 5,000 ms
コード長 336 bytes
コンパイル時間 1,950 ms
コンパイル使用メモリ 161,780 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-26 19:28:45
合計ジャッジ時間 3,537 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
  int n, res = 0;
  cin >> n;
  vector<int> a(n);
  for (int& i : a) cin >> i;
  sort(a.begin(), a.end());
  for (int i = 0; i < n; ++i) {
    if (i != 0 && a[i - 1] == a[i]) continue;
    if (i != n - 1 && a[i + 1] == a[i]) continue;
    ++res;
  }
  cout << res << endl;
}
0