結果

問題 No.3016 unordered_mapなるたけ落とすマン
ユーザー hogeover30hogeover30
提出日時 2016-05-22 02:59:39
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 870 bytes
コンパイル時間 1,608 ms
コンパイル使用メモリ 167,528 KB
実行使用メモリ 7,620 KB
最終ジャッジ日時 2024-04-16 12:06:52
合計ジャッジ時間 10,323 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 AC 34 ms
7,552 KB
testcase_36 AC 32 ms
7,620 KB
testcase_37 AC 33 ms
7,620 KB
testcase_38 AC 33 ms
7,620 KB
testcase_39 AC 33 ms
7,488 KB
testcase_40 AC 34 ms
7,616 KB
testcase_41 AC 2 ms
6,940 KB
testcase_42 AC 2 ms
6,940 KB
testcase_43 AC 2 ms
6,940 KB
testcase_44 AC 5 ms
6,944 KB
testcase_45 AC 5 ms
6,940 KB
testcase_46 AC 5 ms
6,944 KB
testcase_47 RE -
testcase_48 RE -
testcase_49 RE -
testcase_50 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include <unistd.h>
//using namespace std;int main(){long n,a;map<long,int>r;for(cin>>n>>a;cin>>a;--n<0?cout<<r[a]<<' ',0:++r[a]);}
using namespace std;

const int bufsize=16*100010;
char buf[bufsize];
const char* delimiter=" \n";

long a[100010], c[100010], r[100010];

int main()
{
    read(0, buf, bufsize);
    int n=atoi(strtok(buf, delimiter));
    int m=atoi(strtok(0, delimiter));

    for(int i=0; i<n; ++i) a[i]=atol(strtok(0, delimiter));
    sort(a, a+n);
    int k=0;
    c[k]=1;
    r[0]=0;
    for(int i=1; i<n; ++i) {
        if (a[i]==a[i-1])
            ++c[k];
        else {
            ++c[++k];
            r[i]=k;
        }
    }
    //n=unique(a, a+n)-a;

    for(int i=0; i<m; ++i) {
        long b=atol(strtok(0, delimiter));
        int p=lower_bound(a, a+n, b)-a;
        printf("%d ", a[p]==b ? c[r[p]] : 0);
    }
}
0