結果

問題 No.1675 Strange Minimum Query
ユーザー kwm_tkwm_t
提出日時 2021-09-10 21:52:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,780 bytes
コンパイル時間 3,879 ms
コンパイル使用メモリ 234,452 KB
実行使用メモリ 9,604 KB
最終ジャッジ日時 2023-09-02 17:00:56
合計ジャッジ時間 12,546 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 115 ms
5,444 KB
testcase_04 AC 102 ms
6,592 KB
testcase_05 AC 11 ms
5,208 KB
testcase_06 AC 137 ms
6,004 KB
testcase_07 AC 151 ms
7,268 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 81 ms
7,576 KB
testcase_11 AC 28 ms
6,740 KB
testcase_12 AC 90 ms
7,872 KB
testcase_13 AC 142 ms
9,344 KB
testcase_14 AC 187 ms
9,344 KB
testcase_15 WA -
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 36 ms
4,432 KB
testcase_18 AC 50 ms
4,708 KB
testcase_19 AC 70 ms
7,284 KB
testcase_20 AC 165 ms
8,460 KB
testcase_21 AC 142 ms
8,120 KB
testcase_22 AC 181 ms
8,672 KB
testcase_23 AC 147 ms
5,700 KB
testcase_24 AC 131 ms
6,216 KB
testcase_25 AC 96 ms
5,232 KB
testcase_26 AC 45 ms
5,488 KB
testcase_27 AC 121 ms
8,184 KB
testcase_28 AC 65 ms
7,280 KB
testcase_29 AC 48 ms
7,056 KB
testcase_30 AC 46 ms
5,492 KB
testcase_31 AC 191 ms
7,124 KB
testcase_32 AC 246 ms
9,380 KB
testcase_33 AC 248 ms
9,392 KB
testcase_34 AC 246 ms
9,432 KB
testcase_35 AC 230 ms
9,452 KB
testcase_36 AC 233 ms
9,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#include "atcoder/all"
using namespace std;
using namespace atcoder;
//using mint = modint1000000007;
//const int mod = 1000000007;
//using mint = modint998244353;
//const int mod = 998244353;
const int INF = 1e9;
//const long long LINF = 1e18;
//const bool debug = false;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i,l,r)for(int i=(l);i<(r);++i)
#define rrep(i, n) for (int i = (n-1); i >= 0; --i)
#define rrep2(i,l,r)for(int i=(r-1);i>=(l);--i)
#define all(x) (x).begin(),(x).end()
#define allR(x) (x).rbegin(),(x).rend()
#define endl "\n"
#define P pair<int,int>
template<typename A, typename B> inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; }
template<typename A, typename B> inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; }
using S = int;
using F = int;

S op(S a, S b) { return std::min(a, b); }
S e() { return INF; }
S mapping(F f, S x) { return (f == INF ? x : f); }
F composition(F f, F g) { return (f == INF ? g : f); }
F id() { return INF; }

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, q; cin >> n >> q;
	vector<pair<int, P>>v(q);
	rep(i, q) {
		int l, r, b; cin >> l >> r >> b;
		l--; r--;
		v[i] = { b,{l,r} };
	}
	sort(all(v));
	vector<int>vs(n, INF);
	lazy_segtree<S, op, e, F, mapping, composition, id> seg(vs);
	rep(i, q) {
		int x = v[i].first;
		int l = v[i].second.first;
		int r = v[i].second.second;
		seg.apply(l, r + 1, x);
	}
	rep(i, q) {
		int x = v[i].first;
		int l = v[i].second.first;
		int r = v[i].second.second;
		int y = seg.prod(l, r + 1);
		if (x != y) {
			cout << -1 << endl;
			return 0;
		}
	}
	rep(i, n) {
		if (0 != i)cout << " ";
		cout << seg.get(i);
	}
	cout << endl;
	return 0;
}
0