結果

問題 No.1722 [Cherry 3rd Tune C] In my way
ユーザー sister_DB
提出日時 2021-11-05 14:17:46
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 616 bytes
コンパイル時間 1,092 ms
コンパイル使用メモリ 78,484 KB
最終ジャッジ日時 2025-01-25 11:51:36
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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];
    }
    
    //sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    
    for(int i = 0; i < n; ++i){
        auto itr = lower_bound(b.begin(), b.end(), a[i]);
        if(itr == b.end()){
            cout << "Infinity" << " ";
        }else{
            cout << *itr - a[i] << " ";
        }
    }
    cout << endl;
    
    
    return 0;
}
0