結果
問題 |
No.182 新規性の虜
|
ユーザー |
|
提出日時 | 2020-09-17 22:00:35 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 23 ms / 5,000 ms |
コード長 | 564 bytes |
コンパイル時間 | 3,645 ms |
コンパイル使用メモリ | 195,852 KB |
最終ジャッジ日時 | 2025-01-14 15:42:24 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#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; if (v.size() == 1) { ans = 1; } else { 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(); }