結果

問題 No.1722 [Cherry 3rd Tune C] In my way
ユーザー yansi819
提出日時 2024-03-21 10:44:07
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 486 bytes
コンパイル時間 4,295 ms
コンパイル使用メモリ 253,368 KB
最終ジャッジ日時 2025-02-20 10:32:27
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ld = long double;

int N, M, X[1010], Y[1010];

int main() {
  cin >> N >> M;
  for (int i = 0; i < N; i++) cin >> X[i];
  for (int i = 0; i < M; i++) cin >> Y[i];
  sort(Y, Y + M);
  for (int i = 0; i < N; i++) {
    int pos = lower_bound(Y, Y + M, X[i]) - Y;
    if (pos == M) cout << "Infinity" << endl;
    else cout << Y[pos] - X[i] << endl;
  }
  return 0;
}
0