結果
| 問題 | No.678 2Dシューティングゲームの必殺ビーム | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-06-02 19:48:54 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 3 ms / 2,000 ms | 
| コード長 | 1,104 bytes | 
| コンパイル時間 | 867 ms | 
| コンパイル使用メモリ | 75,760 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-06-30 09:04:55 | 
| 合計ジャッジ時間 | 1,621 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 18 | 
ソースコード
#include <iostream>
#include <fstream>
#include <algorithm>
#include <bitset>
#include <vector>
using namespace std;
const int NX = 1280;
const int NY = 1680;
typedef bitset<NX+1> Seq;
struct Enemy {
	int i;
	int y;
	bool h;
	Seq s;
};
Seq MakeSeq(int xl, int xr) {
	Seq s;
	for (int i = xl; i <= xr; i++) {
		s |= Seq(1) << i;
	}
	return s;
}
int main() {
	int n, xl, xr;
	cin >> n >> xl >> xr;
	Seq b = MakeSeq(xl, xr);
	
	vector<Enemy> es;
	for (int i = 0; i < n; i++) {
		int y, foo;
		cin >> xl >> foo >> xr >> y;
		xl = xl < 1 ? 1 : xl;
		xl = xl > NX ? NX : xl;
		xr = xr < 1 ? 1 : xr;
		xr = xr > NX ? NX : xr;
		y = y < 1 ? 1 : y;
		y = y > NY ? NY : y;
		Enemy e;
		e.i = i;
		e.y = y;
		e.h = false;
		e.s = MakeSeq(xl, xr);
		es.emplace_back(e);
	}
	sort(es.begin(), es.end(), [](const Enemy& a, const Enemy& b) { return a.y > b.y; });
	for (Enemy& e : es) {
		if (e.s != (e.s & ~b)) {
			e.h = true;
		}
		b = ~e.s & b;
	}
	sort(es.begin(), es.end(), [](const Enemy& a, const Enemy& b) { return a.i < b.i; });
	for (const Enemy& e : es) {
		cout << e.h << endl;
	}
	return 0;
}
            
            
            
        