結果
問題 |
No.8016 unordered_mapなるたけ落とすマン
|
ユーザー |
![]() |
提出日時 | 2016-05-22 02:59:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 870 bytes |
コンパイル時間 | 1,477 ms |
コンパイル使用メモリ | 170,024 KB |
実行使用メモリ | 7,552 KB |
最終ジャッジ日時 | 2024-10-07 06:15:32 |
合計ジャッジ時間 | 4,739 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 RE * 36 |
ソースコード
#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); } }