結果
問題 |
No.1722 [Cherry 3rd Tune C] In my way
|
ユーザー |
👑 ![]() |
提出日時 | 2021-10-29 21:25:24 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 963 bytes |
コンパイル時間 | 2,800 ms |
コンパイル使用メモリ | 107,872 KB |
最終ジャッジ日時 | 2025-01-25 08:23:34 |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; using i32 = int32_t; using u32 = uint32_t; using i64 = int64_t; using u64 = uint64_t; #define rep(i,n) for(int i=0; i<(n); i++) int main(){ int num_people; cin >> num_people; int num_walls; cin >> num_walls; vector<int> pos_people(num_people); for(int& a : pos_people) cin >> a; vector<int> pos_walls(num_walls); for(int& a : pos_walls) cin >> a; sort(pos_walls.begin(), pos_walls.end()); for(int& x : pos_people){ auto first_hit = lower_bound(pos_walls.begin(), pos_walls.end(), x) - pos_walls.begin(); if(first_hit == pos_walls.size()){ cout << "Infinity\n"; } else{ auto pos_hit = pos_walls[first_hit]; int ans = pos_hit - x; cout << ans << "\n"; } } return 0; } struct ios_do_not_sync { ios_do_not_sync() { ios::sync_with_stdio(false); cin.tie(nullptr); } } ios_do_not_sync_instance;