結果

問題 No.678 2Dシューティングゲームの必殺ビーム
ユーザー kurenai3110kurenai3110
提出日時 2018-04-27 22:32:48
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 884 bytes
コンパイル時間 806 ms
コンパイル使用メモリ 73,844 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-10 06:26:36
合計ジャッジ時間 1,677 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

typedef long long ll;

struct ENEMY {
	int l, u, r, d;
	int id;

	bool operator<(const ENEMY &r)const {
		return d > r.d;
	}
};

int main() {
	int N; cin >> N;
	int l, r; cin >> l >> r;

	vector<ENEMY>enemy;
	for (int i = 0; i < N; i++) {
		int l, u, r, d;
		cin >> l >> u >> r >> d;
		l = max(l, 0);
		r = min(r, 1280);
		enemy.push_back(ENEMY({ l, u, r, d, i }));
	}

	sort(enemy.begin(), enemy.end());
	vector<int>ans(N);
	vector<char>used(1281);
	for (int j = l; j <= r; j++)used[j] = true;
	for (int i = 0; i < N; i++) {
		bool flag = false;
		for (int j = enemy[i].l; j <= enemy[i].r; j++) {
			if (used[j]) {
				flag = true;
				used[j] = false;
			}
		}

		ans[enemy[i].id] = flag;
	}

	for (int i = 0; i < N; i++) {
		cout << ans[i] << endl;
	}

	return 0;
}
0