結果

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

テストケース

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