結果

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