結果
問題 | No.678 2Dシューティングゲームの必殺ビーム |
ユーザー |
![]() |
提出日時 | 2018-04-27 22:32:48 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 884 bytes |
コンパイル時間 | 661 ms |
コンパイル使用メモリ | 72,828 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-27 21:55:39 |
合計ジャッジ時間 | 1,353 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 |
ソースコード
#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;}