結果

問題 No.182 新規性の虜
ユーザー ikdikd
提出日時 2015-11-02 13:32:03
言語 C++11
(gcc 11.4.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 471 bytes
コンパイル時間 365 ms
コンパイル使用メモリ 59,036 KB
最終ジャッジ日時 2024-04-27 02:14:20
合計ジャッジ時間 903 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:5: error: ‘vector’ was not declared in this scope
   12 |     vector<long long int> a(n);
      |     ^~~~~~
main.cpp:5:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
    4 | #include<map>
  +++ |+#include <vector>
    5 | 
main.cpp:12:12: error: expected primary-expression before ‘long’
   12 |     vector<long long int> a(n);
      |            ^~~~
main.cpp:14:15: error: ‘a’ was not declared in this scope
   14 |         cin>> a[i];
      |               ^
main.cpp:19:12: error: ‘a’ was not declared in this scope
   19 |         ma[a[i]]++;
      |            ^

ソースコード

diff #

#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<map>

using namespace std;

int main(){
    int n;
    cin>> n;

    vector<long long int> a(n);
    for(int i=0; i<n; i++){
        cin>> a[i];
    }

    map<int, int> ma;
    for(int i=0; i<n; i++){
        ma[a[i]]++;
    }

    int ans=0;
    auto it = ma.begin();
    for(it; it!=ma.end(); it++){
        if(it->second==1){
            ans++;
        }
    }

    cout<< ans<< endl;
    return 0;
}
0