結果
問題 |
No.182 新規性の虜
|
ユーザー |
![]() |
提出日時 | 2016-01-06 11:15:40 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 40 ms / 5,000 ms |
コード長 | 430 bytes |
コンパイル時間 | 594 ms |
コンパイル使用メモリ | 59,132 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-26 20:04:17 |
合計ジャッジ時間 | 2,049 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include<iostream> #include<algorithm> using namespace std; int main(void) { int n, i, ans; long long int pa[100005] = {0}; cin >> n; ans = n; for (i = 0; i < n; i++) { cin >> pa[i]; } sort(pa, pa + n); for (i = 0; i < n - 1; i++) { if (pa[i] == pa[i + 1]) ans -= 2; if (pa[i] == pa[i + 1] && pa[i + 1] == pa[i + 2]) ans += 1; } if (pa[0] == pa[n - 1]&&n!=1) ans = 0; cout << ans << endl; return 0; }