結果

問題 No.182 新規性の虜
ユーザー test
提出日時 2020-09-17 21:57:30
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 505 bytes
コンパイル時間 1,882 ms
コンパイル使用メモリ 196,796 KB
最終ジャッジ日時 2025-01-14 15:42:15
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i, ss, ee) for (int i = ss; i < ee; ++i)
using namespace std;

int N;
vector<int> v;

void input() {
  cin >> N;
  v.resize(N);
  for (auto &e : v) cin >> e;
  sort(v.begin(), v.end());
}

void solve() {
  int ans = 0;
  rep(i, 1, N - 1) if (v[i - 1] != v[i] && v[i] != v[i + 1]) ans++;
  if (v[0] != v[1] ) ans++;
  if (v[N-1] != v[N-2] ) ans++;
  cout << ans << endl;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  input();
  solve();
  getchar();
}
0