結果

問題 No.678 2Dシューティングゲームの必殺ビーム
ユーザー m-44m-44
提出日時 2019-09-24 22:37:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 793 bytes
コンパイル時間 1,542 ms
コンパイル使用メモリ 172,328 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 16:58:40
合計ジャッジ時間 2,945 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

struct enemy { int xl, yu, xr, yd; };

int main() {
  int n, xlb, xrb;
  cin>>n>>xlb>>xrb;

  enemy es[n];
  pair<int, int> yds[n];
  for (int i=0; i<n; i++) {
    int xl, yu, xr, yd;
    cin>>xl>>yu>>xr>>yd;
    es[i] = {xl, yu, xr, yd};
    yds[i] = {yd, i};
  }
  sort(yds, yds + n);
  reverse(yds, yds + n);
  int beam[1281];
  for (int i=0; i<1281; i++) beam[i] = 1;
  int ans[n];
  for (int i=0; i<n; i++) ans[i] = 0;
  for (auto yd: yds) {
    enemy e = es[yd.second];
    for (int i=max(e.xl, 0); i<=min(e.xr, 1280); i++) {
      if (beam[i] == 1) {
        ans[yd.second] = 1;
        for (int j=i; j<=min(e.xr, 1280); j++) {
          beam[j] = 0;
        }
        break;
      }
    }
  }
  for (int i: ans) {
    cout<<i<<endl;
  }
}
0