結果
問題 |
No.1722 [Cherry 3rd Tune C] In my way
|
ユーザー |
![]() |
提出日時 | 2021-11-05 14:18:35 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 6 ms / 2,000 ms |
コード長 | 600 bytes |
コンパイル時間 | 868 ms |
コンパイル使用メモリ | 78,196 KB |
最終ジャッジ日時 | 2025-01-25 11:51:40 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
#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" << endl; }else{ cout << *itr - a[i] << endl; } } return 0; }