結果
| 問題 | No.8016 unordered_mapなるたけ落とすマン |
| ユーザー |
|
| 提出日時 | 2016-05-22 14:31:56 |
| 言語 | C++11(old_compat) (gcc 12.4.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 62 ms / 1,000 ms |
| コード長 | 532 bytes |
| 記録 | |
| コンパイル時間 | 1,665 ms |
| コンパイル使用メモリ | 173,088 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2026-03-10 23:38:49 |
| 合計ジャッジ時間 | 9,072 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 48 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%d%d", &n, &m);
| ~~~~~^~~~~~~~~~~~~~~~
main.cpp:14:33: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | for(int i=0; i<n; ++i) { scanf("%lld", &a[i]); }
| ~~~~~^~~~~~~~~~~~~~~
main.cpp:15:33: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
15 | for(int i=0; i<m; ++i) { scanf("%lld", &b[i]); }
| ~~~~~^~~~~~~~~~~~~~~
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
using i64 = long long;
const int N = 10010;
int n, m;
vector<i64> a, b;
int main(void) {
scanf("%d%d", &n, &m);
a.assign(n, 0);
b.assign(m, 0);
for(int i=0; i<n; ++i) { scanf("%lld", &a[i]); }
for(int i=0; i<m; ++i) { scanf("%lld", &b[i]); }
sort(a.begin(), a.end());
for(int i=0; i<m; ++i) {
if(i) { putchar(' '); }
printf("%ld", upper_bound(a.begin(), a.end(), b[i]) - lower_bound(a.begin(), a.end(), b[i]));
}
putchar('\n');
return 0;
}