結果
| 問題 | 
                            No.678 2Dシューティングゲームの必殺ビーム
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2018-06-02 19:26:40 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,076 bytes | 
| コンパイル時間 | 858 ms | 
| コンパイル使用メモリ | 76,592 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-06-30 09:04:37 | 
| 合計ジャッジ時間 | 1,680 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 13 WA * 5 | 
ソースコード
#include <iostream>
#include <fstream>
#include <algorithm>
#include <bitset>
#include <vector>
using namespace std;
const int N = 1280;
typedef bitset<N+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 < 0 ? 0 : xl;
		xl = xl > N ? N : xl;
		xr = xr < 0 ? 0 : xr;
		xr = xr > N ? N : xr;
		y = y < 0 ? 0 : y;
		y = y > N ? N : 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;
}