結果

問題 No.2650 [Cherry 6th Tune *] セイジャク
ユーザー ぷらぷら
提出日時 2024-02-23 21:54:50
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 166 ms / 2,500 ms
コード長 1,398 bytes
コンパイル時間 3,367 ms
コンパイル使用メモリ 145,448 KB
実行使用メモリ 9,600 KB
最終ジャッジ日時 2024-02-23 21:55:18
合計ジャッジ時間 7,713 ms
ジャッジサーバーID
(参考情報)
judge16 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 39 ms
6,676 KB
testcase_03 AC 8 ms
6,676 KB
testcase_04 AC 44 ms
6,676 KB
testcase_05 AC 36 ms
6,676 KB
testcase_06 AC 19 ms
6,676 KB
testcase_07 AC 36 ms
6,676 KB
testcase_08 AC 18 ms
6,676 KB
testcase_09 AC 100 ms
9,600 KB
testcase_10 AC 99 ms
9,600 KB
testcase_11 AC 99 ms
9,600 KB
testcase_12 AC 98 ms
9,600 KB
testcase_13 AC 100 ms
9,600 KB
testcase_14 AC 97 ms
9,600 KB
testcase_15 AC 100 ms
9,600 KB
testcase_16 AC 165 ms
9,600 KB
testcase_17 AC 159 ms
9,600 KB
testcase_18 AC 161 ms
9,600 KB
testcase_19 AC 157 ms
9,600 KB
testcase_20 AC 166 ms
9,600 KB
testcase_21 AC 162 ms
9,600 KB
testcase_22 AC 159 ms
9,600 KB
testcase_23 AC 117 ms
9,600 KB
testcase_24 AC 118 ms
9,600 KB
testcase_25 AC 116 ms
9,600 KB
testcase_26 AC 114 ms
9,600 KB
testcase_27 AC 116 ms
9,600 KB
testcase_28 AC 116 ms
9,600 KB
testcase_29 AC 120 ms
9,600 KB
testcase_30 AC 146 ms
9,600 KB
testcase_31 AC 103 ms
9,600 KB
testcase_32 AC 105 ms
8,960 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <string.h>
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,A;
    cin >> N >> A;
    vector<int>X(N);
    for(int i = 0; i < N; i++) {
        cin >> X[i];
    }
    int T;
    cin >> T;
    vector<int>L(T),R(T);
    for(int i = 0; i < T; i++) {
        cin >> L[i] >> R[i];
    }
    set<pair<int,int>>st;
    for(int i = 0; i < N; i++) {
        st.insert({X[i],i});
    }
    vector<int>ans(N,-1);
    for(int i = T-1; i >= 0; i--) {
        while(st.lower_bound({L[i],-1}) != st.end()) {
            auto it = st.lower_bound({L[i],-1});
            if((*it).first <= R[i]) {
                ans[(*it).second] = i+1;
                st.erase(it);
                continue;
            }
            else {
                break;
            }
        }
    }
    for(int i = 0; i < N; i++) {
        cout << ans[i] << "\n";
    }
}
0