結果

問題 No.3016 unordered_mapなるたけ落とすマン
ユーザー threepipes_sthreepipes_s
提出日時 2016-05-22 02:13:53
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 483 bytes
コンパイル時間 1,969 ms
コンパイル使用メモリ 72,848 KB
実行使用メモリ 9,984 KB
最終ジャッジ日時 2024-04-16 12:05:04
合計ジャッジ時間 8,012 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 78 ms
9,728 KB
testcase_04 WA -
testcase_05 AC 118 ms
9,728 KB
testcase_06 WA -
testcase_07 AC 120 ms
9,856 KB
testcase_08 AC 126 ms
9,856 KB
testcase_09 AC 112 ms
9,856 KB
testcase_10 AC 115 ms
9,856 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 96 ms
9,856 KB
testcase_14 AC 91 ms
9,984 KB
testcase_15 AC 82 ms
9,728 KB
testcase_16 AC 81 ms
9,856 KB
testcase_17 AC 85 ms
9,856 KB
testcase_18 AC 85 ms
9,984 KB
testcase_19 AC 88 ms
9,856 KB
testcase_20 AC 85 ms
9,728 KB
testcase_21 AC 84 ms
9,856 KB
testcase_22 AC 84 ms
9,856 KB
testcase_23 AC 82 ms
9,856 KB
testcase_24 AC 81 ms
9,984 KB
testcase_25 AC 79 ms
9,856 KB
testcase_26 AC 79 ms
9,856 KB
testcase_27 AC 81 ms
9,856 KB
testcase_28 AC 78 ms
9,856 KB
testcase_29 AC 78 ms
9,728 KB
testcase_30 AC 76 ms
9,728 KB
testcase_31 AC 75 ms
9,856 KB
testcase_32 AC 76 ms
9,728 KB
testcase_33 AC 75 ms
9,856 KB
testcase_34 AC 74 ms
9,728 KB
testcase_35 AC 72 ms
9,856 KB
testcase_36 AC 74 ms
9,984 KB
testcase_37 AC 73 ms
9,856 KB
testcase_38 AC 74 ms
9,856 KB
testcase_39 AC 72 ms
9,728 KB
testcase_40 AC 70 ms
9,728 KB
testcase_41 AC 2 ms
5,376 KB
testcase_42 AC 2 ms
5,376 KB
testcase_43 AC 2 ms
5,376 KB
testcase_44 AC 7 ms
5,376 KB
testcase_45 AC 7 ms
5,376 KB
testcase_46 AC 7 ms
5,376 KB
testcase_47 AC 72 ms
7,424 KB
testcase_48 WA -
testcase_49 AC 71 ms
7,808 KB
testcase_50 AC 42 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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