結果

問題 No.678 2Dシューティングゲームの必殺ビーム
ユーザー EsireEsire
提出日時 2018-11-26 19:27:59
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,406 bytes
コンパイル時間 940 ms
コンパイル使用メモリ 102,084 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-30 22:18:32
合計ジャッジ時間 2,082 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

//g++ -std=c++11 -Wall -O2 -o main.exe main.cpp
//g++ -std=c++14 -Wall -O2 -o main.exe main.cpp

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <functional>
#include <algorithm>
#include <complex>
#include <numeric>
#include <queue>
#include <stack>
#include <tuple>

using namespace std;

#define spc " "
#define MOD 1000000007

typedef long long ll;
typedef long double ld;
typedef pair<int, int> p_ii;
typedef tuple<int, int, int, int> tup;

bool tupComp(tup &t1, tup &t2){
    return get<2>(t1) > get<2>(t2);
}

//------------------------------------------------------------------------------

int main(){
    int n, xlb, xrb;
    cin >> n >> xlb >> xrb;
    vector<int> b(1281, 0);
    for(int i = xlb; i <= xrb; i++) b[i] = 1;

    vector<tup> e;
    int t1, t2, t3, t4;
    for(int i = 0; i < n; i++){
        cin >> t1 >> t2 >> t3 >> t4;
        e.push_back( tup(max(1, t1), min(1280, t3), t4, i) );
    }
    sort(e.begin(), e.end(), tupComp);
 
    int ans;
    vector<int> ansv(n);
    for(int i = 0; i < n; i++){
        ans = 0;
        for(int j = get<0>(e[i]); j <= get<1>(e[i]); j++){
            if(b[j] == 1){
                b[j] = 0;
                ans = 1;
            }
        }
        ansv[get<3>(e[i])] = ans;
    }
    for(int i = 0; i < n; i++) cout << ansv[i] << endl;

    return 0;
}
0