# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1092916 |
2024-09-25T11:16:02 Z |
ByeWorld |
RMQ (NOI17_rmq) |
C++14 |
|
1000 ms |
10972 KB |
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define int long long
#define ll long long
#define pb push_back
#define fi first
#define se second
#define lf (id<<1)
#define rg ((id<<1)|1)
#define md ((l+r)>>1)
using namespace std;
typedef pair<int,int> pii;
typedef pair<pii,int> ipii;
const int MAXN = 1e5+15;
const int INF = 1e18+10;
const int MOD = 998244353;
const int LOG = 32;
int n, m;
int ans[MAXN];
vector <ipii> vec;
vector <int> add[MAXN];
multiset <int> s;
bool aman = 1;
signed main(){
// ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin >> n >> m;
for(int i=1; i<=m; i++){
int l, r, mn; cin >>l>>r>>mn;
l++; r++; mn++;
vec.pb({{l,r}, mn});
add[l].pb(mn); add[r+1].pb(-mn);
}
for(int i=1; i<=n; i++) ans[i] = n;
for(int i=1; i<=n; i++){
for(auto in : add[i]){
if(in < 0) s.erase(s.find(-in));
else s.insert(in);
}
if(!s.empty()) ans[i] = *(--s.end());
}
for(int i=0; i<m; i++){
int l=vec[i].fi.fi, r=vec[i].fi.se, mn = vec[i].se;
int val = ans[l];
for(int j=l+1; j<=r; j++) val = min(val, ans[j]);
if(val != mn) aman = 0;
}
if(!aman){
for(int i=1; i<=n; i++) cout << "-1 ";
cout << '\n';
} else {
for(int i=1; i<=n; i++) cout << ans[i]-1 << ' ';
cout << '\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
2648 KB |
Output is partially correct |
2 |
Partially correct |
1 ms |
2652 KB |
Output is partially correct |
3 |
Partially correct |
1 ms |
2656 KB |
Output is partially correct |
4 |
Partially correct |
2 ms |
2652 KB |
Output is partially correct |
5 |
Partially correct |
1 ms |
2652 KB |
Output is partially correct |
6 |
Correct |
1 ms |
2652 KB |
Output is correct |
7 |
Correct |
1 ms |
2652 KB |
Output is correct |
8 |
Correct |
1 ms |
2652 KB |
Output is correct |
9 |
Correct |
1 ms |
2652 KB |
Output is correct |
10 |
Correct |
1 ms |
2652 KB |
Output is correct |
11 |
Partially correct |
1 ms |
2652 KB |
Output is partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
2648 KB |
Output is partially correct |
2 |
Partially correct |
1 ms |
2652 KB |
Output is partially correct |
3 |
Partially correct |
1 ms |
2656 KB |
Output is partially correct |
4 |
Partially correct |
2 ms |
2652 KB |
Output is partially correct |
5 |
Partially correct |
1 ms |
2652 KB |
Output is partially correct |
6 |
Correct |
1 ms |
2652 KB |
Output is correct |
7 |
Correct |
1 ms |
2652 KB |
Output is correct |
8 |
Correct |
1 ms |
2652 KB |
Output is correct |
9 |
Correct |
1 ms |
2652 KB |
Output is correct |
10 |
Correct |
1 ms |
2652 KB |
Output is correct |
11 |
Partially correct |
1 ms |
2652 KB |
Output is partially correct |
12 |
Partially correct |
2 ms |
2652 KB |
Output is partially correct |
13 |
Partially correct |
2 ms |
2652 KB |
Output is partially correct |
14 |
Partially correct |
2 ms |
2652 KB |
Output is partially correct |
15 |
Partially correct |
2 ms |
2652 KB |
Output is partially correct |
16 |
Partially correct |
3 ms |
2652 KB |
Output is partially correct |
17 |
Partially correct |
2 ms |
2652 KB |
Output is partially correct |
18 |
Partially correct |
2 ms |
2652 KB |
Output is partially correct |
19 |
Partially correct |
1 ms |
2652 KB |
Output is partially correct |
20 |
Partially correct |
1 ms |
2652 KB |
Output is partially correct |
21 |
Correct |
2 ms |
2652 KB |
Output is correct |
22 |
Correct |
2 ms |
2652 KB |
Output is correct |
23 |
Correct |
1 ms |
2652 KB |
Output is correct |
24 |
Correct |
2 ms |
2652 KB |
Output is correct |
25 |
Correct |
1 ms |
2584 KB |
Output is correct |
26 |
Partially correct |
1 ms |
2652 KB |
Output is partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
2648 KB |
Output is partially correct |
2 |
Partially correct |
1 ms |
2652 KB |
Output is partially correct |
3 |
Partially correct |
1 ms |
2656 KB |
Output is partially correct |
4 |
Partially correct |
2 ms |
2652 KB |
Output is partially correct |
5 |
Partially correct |
1 ms |
2652 KB |
Output is partially correct |
6 |
Correct |
1 ms |
2652 KB |
Output is correct |
7 |
Correct |
1 ms |
2652 KB |
Output is correct |
8 |
Correct |
1 ms |
2652 KB |
Output is correct |
9 |
Correct |
1 ms |
2652 KB |
Output is correct |
10 |
Correct |
1 ms |
2652 KB |
Output is correct |
11 |
Partially correct |
1 ms |
2652 KB |
Output is partially correct |
12 |
Partially correct |
2 ms |
2652 KB |
Output is partially correct |
13 |
Partially correct |
2 ms |
2652 KB |
Output is partially correct |
14 |
Partially correct |
2 ms |
2652 KB |
Output is partially correct |
15 |
Partially correct |
2 ms |
2652 KB |
Output is partially correct |
16 |
Partially correct |
3 ms |
2652 KB |
Output is partially correct |
17 |
Partially correct |
2 ms |
2652 KB |
Output is partially correct |
18 |
Partially correct |
2 ms |
2652 KB |
Output is partially correct |
19 |
Partially correct |
1 ms |
2652 KB |
Output is partially correct |
20 |
Partially correct |
1 ms |
2652 KB |
Output is partially correct |
21 |
Correct |
2 ms |
2652 KB |
Output is correct |
22 |
Correct |
2 ms |
2652 KB |
Output is correct |
23 |
Correct |
1 ms |
2652 KB |
Output is correct |
24 |
Correct |
2 ms |
2652 KB |
Output is correct |
25 |
Correct |
1 ms |
2584 KB |
Output is correct |
26 |
Partially correct |
1 ms |
2652 KB |
Output is partially correct |
27 |
Execution timed out |
1047 ms |
10972 KB |
Time limit exceeded |
28 |
Halted |
0 ms |
0 KB |
- |