結果
| 問題 |
No.678 2Dシューティングゲームの必殺ビーム
|
| コンテスト | |
| ユーザー |
trineutron
|
| 提出日時 | 2021-01-15 08:34:55 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 825 bytes |
| コンパイル時間 | 1,975 ms |
| コンパイル使用メモリ | 205,704 KB |
| 最終ジャッジ日時 | 2025-01-17 18:03:05 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using block = tuple<int, int, int, int>;
int main() {
int n, xlb, xrb;
cin >> n >> xlb >> xrb;
vector<block> b(n);
for (int i = 0; i < n; i++) {
int xl, yu, xr, yd;
cin >> xl >> yu >> xr >> yd;
xl = max(xl, xlb);
xr = min(xr, xrb);
xl -= xlb;
xr -= xlb;
b.at(i) = make_tuple(-yd, xl, xr, i);
}
sort(b.begin(), b.end());
vector<bool> h(n, false), beam(xrb - xlb + 1, true);
for (int i = 0; i < n; i++) {
auto [_, xl, xr, idx] = b.at(i);
for (int j = xl; j <= xr; j++) {
if (beam.at(j)) {
h.at(idx) = true;
beam.at(j) = false;
}
}
}
for (int i = 0; i < n; i++) {
cout << h.at(i) << endl;
}
}
trineutron