結果

問題 No.1675 Strange Minimum Query
ユーザー take000take000
提出日時 2021-09-10 21:49:10
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 874 bytes
コンパイル時間 2,150 ms
コンパイル使用メモリ 208,960 KB
実行使用メモリ 6,452 KB
最終ジャッジ日時 2023-09-02 16:52:04
合計ジャッジ時間 9,398 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 162 ms
5,272 KB
testcase_04 AC 137 ms
4,860 KB
testcase_05 WA -
testcase_06 AC 192 ms
5,508 KB
testcase_07 AC 198 ms
5,616 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 87 ms
4,376 KB
testcase_11 AC 20 ms
4,380 KB
testcase_12 AC 95 ms
4,552 KB
testcase_13 WA -
testcase_14 AC 198 ms
6,184 KB
testcase_15 WA -
testcase_16 AC 1 ms
4,376 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
typedef long long ll;
using namespace std;

int main() {
    int N, Q;
    cin >> N >> Q;
    vector<tuple<int, int, int>> vt(Q);
    rep(i, Q) {
        int l, r, b;
        cin >> l >> r >> b;
        l--, r--;
        vt[i] = {l, -r, b};
    }
    sort(vt.begin(), vt.end());

    int i = 0;
    vector<int> ans(N, 1e9);
    for (auto &[l, r, b] : vt) {
        r = -r;
        bool flag = false;
        for (int j = max(l, i); j <= r; ++j) {
            i++;
            if (ans[j] > b) {
                ans[j] = b;
                flag = true;
                break;
            }
        }
        if (!flag) {
            cout << -1 << endl;
            return 0;
        }
    }

    rep(i, N) {
        if (i != 0) cout << " ";
        cout << ans[i];
    }
    cout << endl;

    return 0;
}
0