結果

問題 No.1722 [Cherry 3rd Tune C] In my way
ユーザー kkkk97368086
提出日時 2021-12-04 16:42:02
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 14 ms / 2,000 ms
コード長 518 bytes
コンパイル時間 2,035 ms
コンパイル使用メモリ 189,244 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-06 22:52:16
合計ジャッジ時間 2,780 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _GLIBCXX_DEBUG
#define ll long long
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;

int main(){
  int N, M; cin >> N >> M;
  vector<int> A(N), B(M);
  for(int i = 0; i < N; i++) cin >> A[i];
  for(int i = 0; i < M; i++) cin >> B[i];
  for(int i = 0; i < N; i++){
    int ans = INT_MAX;
    for(int j = 0; j < M; j++){
      if(A[i] < B[j]){
        ans = min(ans, B[j]-A[i]);
      }
    }
    if(ans != INT_MAX) cout << ans << endl;
    else cout << "Infinity" << endl;
  }
}
0