結果
問題 | No.182 新規性の虜 |
ユーザー |
![]() |
提出日時 | 2015-07-25 17:42:47 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 20 ms / 5,000 ms |
コード長 | 483 bytes |
コンパイル時間 | 2,166 ms |
コンパイル使用メモリ | 159,276 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-26 19:30:23 |
合計ジャッジ時間 | 2,563 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
コンパイルメッセージ
main.cpp: In function ‘void input()’: main.cpp:20:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 20 | scanf("%d", &n); | ~~~~~^~~~~~~~~~ main.cpp:21:19: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 21 | rep(i,n) scanf("%d", a+i); | ~~~~~^~~~~~~~~~~
ソースコード
#include <bits/stdc++.h> using namespace std; #define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define rep(i,n) repi(i,0,n) int n, a[100010]; int solve() { sort(a,a+n); int l = 0, r = 0, ans = 0; while(l < n) { while(r < n and a[r] == a[l]) r++; if(r-l == 1) ans++; l = r; } return ans; } void input() { scanf("%d", &n); rep(i,n) scanf("%d", a+i); } int main() { input(); printf("%d\n", solve()); return 0; }