結果

問題 No.1722 [Cherry 3rd Tune C] In my way
ユーザー Kome_soudou
提出日時 2021-12-15 17:06:25
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 458 bytes
コンパイル時間 1,948 ms
コンパイル使用メモリ 172,944 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-23 19:58:46
合計ジャッジ時間 3,119 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
  int N, M;
  cin >> N >> M;
  vector<int> X(N);
  vector<int> Y(M);
  for(int i = 0; i < N; i++) cin >> X.at(i);
  for(int i = 0; i < M; i++) cin >> Y.at(i);
  sort(Y.begin(), Y.end());
  
  for(int i = 0; i < N; i++)
  {
    auto iter = upper_bound(Y.begin(), Y.end(), X.at(i));
    if(iter - Y.begin() == M) cout << "Infinity" << endl;
    else cout << *iter - X.at(i) << endl;
  }
  return 0;
}
0