結果
問題 | No.8016 unordered_mapなるたけ落とすマン |
ユーザー |
|
提出日時 | 2017-12-14 22:12:08 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 467 bytes |
コンパイル時間 | 590 ms |
コンパイル使用メモリ | 56,772 KB |
最終ジャッジ日時 | 2025-01-05 05:27:17 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 TLE * 2 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:8:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%d%d", &n, &m); | ~~~~~^~~~~~~~~~~~~~~~ main.cpp:12:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%lld", &x); | ~~~~~^~~~~~~~~~~~ main.cpp:18:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 18 | scanf("%lld", &x); | ~~~~~^~~~~~~~~~~~
ソースコード
#include <cstdio> #include <unordered_map> using int64 = long long; int main() { int n, m; scanf("%d%d", &n, &m); std::unordered_map<int64, int> cnt; for (int i = 0; i < n; ++i) { int64 x; scanf("%lld", &x); ++cnt[x]; } for (int i = 0; i < m; ++i) { if (i) putchar(' '); int64 x; scanf("%lld", &x); auto it = cnt.find(x); if (it == cnt.end()) putchar('0'); else printf("%d", it->second); } puts(""); return 0; }