結果

問題 No.678 2Dシューティングゲームの必殺ビーム
ユーザー PachicobuePachicobue
提出日時 2018-04-27 22:40:21
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 1,374 bytes
コンパイル時間 2,277 ms
コンパイル使用メモリ 201,608 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-10 06:31:39
合計ジャッジ時間 2,801 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 3 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define show(x) cerr << #x << " = " << x << endl
using namespace std;
using ll = long long;
using ld = long double;
constexpr ll MOD = 1000000007LL;
template <typename T>
constexpr T INF = numeric_limits<T>::max() / 10;
template <typename Functor>
struct fix_type
{
    Functor functor;
    template <typename... Args>
    decltype(auto) operator()(Args&&... args) const& { return functor(functor, std::forward<Args>(args)...); }
};
template <typename Functor>
fix_type<typename std::decay<Functor>::type> fix(Functor&& functor) { return {std::forward<Functor>(functor)}; }

struct Ship
{
    int xl;
    int xr;
    int yd;
    int yu;
};

int main()
{
    int N;
    cin >> N;
    int L, R;
    cin >> L >> R;
    vector<Ship> ship(N);
    for (int i = 0; i < N; i++) {
        Ship& s = ship[i];
        cin >> s.xl >> s.yu >> s.xr >> s.yd;
    }
    vector<bool> hit(N, false);
    for (int x = L; x <= R; x++) {
        int minind = -1;
        int Y = -501;
        for (int i = 0; i < N; i++) {
            if (ship[i].xl <= x and x <= ship[i].xr) {
                if (Y < ship[i].yd) {
                    Y = ship[i].yd;
                    minind = i;
                }
            }
        }
        if (minind != -1) { hit[minind] = true; }
    }
    for (int i = 0; i < N; i++) {
        cout << hit[i] << endl;
    }
    return 0;
}
0