結果
問題 | No.182 新規性の虜 |
ユーザー |
![]() |
提出日時 | 2015-06-08 13:43:21 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 40 ms / 5,000 ms |
コード長 | 566 bytes |
コンパイル時間 | 676 ms |
コンパイル使用メモリ | 65,964 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-26 19:16:40 |
合計ジャッジ時間 | 2,365 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include <iostream> #include <algorithm> #include <functional> #include <string> #include <climits> #include <vector> #include <numeric> //#define __int32 long long using namespace std; int main(){ int n; int a[100000]; int ans = 0; bool flg; int save; cin >> n; for(int i=0; i<n; i++){ cin >> a[i]; } sort(a, a+n); flg = false; save = -1; for(int i=0; i<n; i++){ if(a[i] == save){ flg = false; }else{ if(flg){ ans ++; } flg = true; save = a[i]; } } if(flg){ ans ++; } cout << ans << endl; return 0; }