結果
問題 | No.678 2Dシューティングゲームの必殺ビーム |
ユーザー |
|
提出日時 | 2020-04-21 21:38:58 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 1,069 bytes |
コンパイル時間 | 1,110 ms |
コンパイル使用メモリ | 82,196 KB |
最終ジャッジ日時 | 2025-01-09 22:10:33 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> struct Data { int lx, rx, y, id; Data(int lx, int rx, int y, int id) : lx(lx), rx(rx), y(y), id(id) {} }; constexpr int X = 1280; void solve() { int n, lbx, rbx; std::cin >> n >> lbx >> rbx; std::vector<bool> hit(X + 1, false); for (int x = lbx; x <= rbx; ++x) hit[x] = true; std::vector<Data> ps; for (int i = 0; i < n; ++i) { int lx, ly, rx, ry; std::cin >> lx >> ly >> rx >> ry; lx = std::max(lx, 0); rx = std::min(rx, X); ps.emplace_back(lx, rx, ry, i); } std::sort(ps.begin(), ps.end(), [](auto lhs, auto rhs) { return lhs.y > rhs.y; }); std::vector<bool> ans(n, false); for (auto p : ps) { for (int x = p.lx; x <= p.rx; ++x) { if (hit[x]) ans[p.id] = true; hit[x] = false; } } for (auto a : ans) std::cout << a << std::endl; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }