#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define bug cout << "bug" << endl
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define all(x) x.begin(), x.end()
#define F first
#define S second
#define pll pair <ll, ll>
#define pii pair <int, int>
#define triple pair <pair <ll, ll> , ll>
#define ull unsigned long long
#define ld long double
#define pinode pair <node*, node*>
const ll INF = 9e18 + 5;
const ll inf = 1e9 + 5;
const ll N = 1e4 + 5;
const ll shift = 2e6;
const ll mod = 998244353;
const ll mod2 = 1e9 + 9;
const ll M = 1e3 + 5;
const ll LOG = 21;
const ll sp = 263;
const ll sp2 = 9973;
const int block = 100;
const double eps = 1e-10;
int n, m, l[N], r[N], k[N], val[N], a[N], pref[N];
int sb2 = 1, can = 1;
int main(){
speed;
cin >> n >> m;
for(int i = 1; i <= m; i++){
cin >> l[i] >> r[i] >> k[i] >> val[i];
l[i]++;
r[i]++;
if(k[i] != 1)
sb2 = 0;
}
if(sb2){
for(int i = 1; i <= m; i++){
if(val[i] == 1){
a[l[i]]++;
a[r[i] + 1]--;
}
}
for(int i = 1; i <= n; i++){
a[i] += a[i - 1];
}
for(int i = 1; i <= n; i++){
pref[i] = pref[i - 1] + a[i];
}
for(int i = 1; i <= m; i++){
if(val[i] == 0){
if(pref[r[i]] - pref[l[i] - 1] == r[i] - l[i] + 1)
can = 0;
}
}
if(!can){
cout << -1 << endl;
return 0;
}
for(int i = 1; i <= n; i++){
cout << a[i] << " ";
}
return 0;
}
}
/*
%I64d6
6 1 3
8 1 2 1 5 4
%I64d
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
340 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
476 KB |
Output is correct |
2 |
Correct |
3 ms |
468 KB |
Output is correct |
3 |
Correct |
3 ms |
468 KB |
Output is correct |
4 |
Incorrect |
3 ms |
468 KB |
Integer 2 violates the range [-1, 1] |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
476 KB |
Output is correct |
2 |
Correct |
3 ms |
468 KB |
Output is correct |
3 |
Correct |
3 ms |
468 KB |
Output is correct |
4 |
Incorrect |
3 ms |
468 KB |
Integer 2 violates the range [-1, 1] |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
340 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |