結果
| 問題 |
No.1675 Strange Minimum Query
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-10 23:45:41 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,478 bytes |
| コンパイル時間 | 3,842 ms |
| コンパイル使用メモリ | 240,716 KB |
| 実行使用メモリ | 15,760 KB |
| 最終ジャッジ日時 | 2024-06-12 05:40:00 |
| 合計ジャッジ時間 | 14,757 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 WA * 7 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const long long MOD = 998244353;
//const long long INF = 9*1e18;
using ll = long long;
using mint = modint998244353;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
long double PI = 3.14159265358979;
using S = long long;
using F = long long;
const S INF = 1e9+1;
const F ID = 1e9+1;
S op(S a, S b){ return std::min(a, b); }
S e(){ return INF; }
S mapping(F f, S x){ return (f == ID ? x : f); }
F composition(F f, F g){ return (f == ID ? g : f); }
F id(){ return ID; }
int main(){
ll N,Q;
cin>>N>>Q;
vector<ll> v;
v.assign(N,INF);
lazy_segtree<S,op,e,F,mapping,composition,id> seg(v);
vector<tuple<ll,ll,ll>> A(Q);
rep(i,Q){
ll a,b,c;
cin>>a>>b>>c;
a--;
A[i] = {c,a,b};
}
sort(all(A));
rep(i,Q){
seg.apply(get<1>(A[i]),get<2>(A[i]),get<0>(A[i]));
}
bool d = 0;
rep(i,Q){
if(seg.prod(get<1>(A[i]),get<2>(A[i])) != get<0>(A[i])){
d = 1;
}
}
if(d){
cout << -1 << endl;
}
else{
rep(i,N-1){
if(seg.get(i) == INF){
cout << INF-1 << " ";
}
else{
cout << seg.get(i) << " ";
}
}
cout <<seg.get(N-1);
cout << endl;
}
return 0;
}