結果

問題 No.678 2Dシューティングゲームの必殺ビーム
ユーザー ats5515ats5515
提出日時 2018-04-27 22:42:47
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 936 bytes
コンパイル時間 865 ms
コンパイル使用メモリ 95,476 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-27 22:01:30
合計ジャッジ時間 1,511 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
struct Rect {
	int l, u, r, d, ind;
	bool operator<(const Rect& right) const {
		return d > right.d;
	}
};
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	int L, R;
	cin >> L >> R;
	vector<Rect> rect(N);
	for (int i = 0; i < N; i++) {
		cin >> rect[i].l >> rect[i].u >> rect[i].r >> rect[i].d;
		rect[i].ind = i;
	}
	sort(rect.begin(), rect.end());
	set<int> ng;
	for (int i = L; i <= R; i++) {
		ng.insert(i);
	}
	vector<int> res(N, 0);
	for (int i = 0; i < N; i++) {
		for (int j = rect[i].l; j <= rect[i].r; j++) {
			if (ng.count(j) == 1) {
				res[rect[i].ind] = 1;
				ng.erase(j);
			}
		}
	}
	for (int i = 0; i < N; i++) {
		cout << res[i] << endl;
	}
}
0