結果

問題 No.3016 unordered_mapなるたけ落とすマン
ユーザー yuppe19 😺yuppe19 😺
提出日時 2016-05-22 14:31:56
言語 C++11
(gcc 11.4.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 532 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 52,848 KB
最終ジャッジ日時 2024-04-27 02:20:53
合計ジャッジ時間 2,579 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.cpp:8:1: error: ‘vector’ does not name a type
    8 | vector<i64> a, b;
      | ^~~~~~
main.cpp: In function ‘int main()’:
main.cpp:12:3: error: ‘a’ was not declared in this scope
   12 |   a.assign(n, 0);
      |   ^
main.cpp:13:3: error: ‘b’ was not declared in this scope
   13 |   b.assign(m, 0);
      |   ^
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);
      |   ~~~~~^~~~~~~~~~~~~~~~

ソースコード

diff #

#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;
}
0