結果

問題 No.8016 unordered_mapなるたけ落とすマン
ユーザー threepipes_s
提出日時 2016-05-22 02:16:07
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 88 ms / 1,000 ms
コード長 486 bytes
コンパイル時間 762 ms
コンパイル使用メモリ 72,836 KB
実行使用メモリ 9,984 KB
最終ジャッジ日時 2024-10-07 06:14:18
合計ジャッジ時間 6,882 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 48
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:24:19: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘std::map<long int, int>::mapped_type’ {aka ‘int’} [-Wformat=]
   24 |         printf("%ld ", mp[a]);
      |                 ~~^
      |                   |
      |                   long int
      |                 %d
main.cpp:19:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   19 |         scanf("%ld", &a);
      |         ~~~~~^~~~~~~~~~~
main.cpp:23:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   23 |         scanf("%ld", &a);
      |         ~~~~~^~~~~~~~~~~

ソースコード

diff #

#include <iostream>
#include <stdio.h>
#include <map>
#include <vector>
#include <algorithm>
#include <utility>
#include <climits>
#include <queue>
using namespace std;
typedef pair<int, int> P;
typedef long long LL;

int main(){
    int n, m;
    long a;
    cin >> n >> m;
    map<long, int> mp;
    for(int i=0; i<n; i++){
        scanf("%ld", &a);
        mp[a]++;
    }
    for(int i=0; i<m; i++){
        scanf("%ld", &a);
        printf("%ld ", mp[a]);
    }
    printf("\n");
}
0