#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) { cerr << to_string(h); if(sizeof...(t)) cerr << ", "; DBG(t...); }
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
const int N = 5003;
vector<tuple<int, int, int>> uslov[N];
int pref[N], a[N];
void solve() {
int n, m; cin >> n >> m;
for (int i = 0; i < m; i++) {
int l, r, k, v; cin >> l >> r >> k >> v;
if (v == 0) {
int t = (r-l+1)-k;
uslov[r].push_back({l-1, t, 0});
} else {
int t = (r-l+1)-(k-1);
uslov[r].push_back({l-1, t, 1});
}
}
for (int i = 1; i <= n; i++) {
pref[i] = pref[i-1];
bool ima = false, need = false;
for (int j = i; j <= n; j++) {
for (auto [l, t, tp] : uslov[j]) {
if (l >= i) continue;
int cur = pref[i]-pref[l];
if (tp == 0) {
if (cur == t) ima = true;
} else {
if (cur < t) need = true;
}
}
}
if (ima || !need) continue;
a[i] = 1;
pref[i]++;
}
for (int i = 1; i <= n; i++)
cout << a[i] << " ";
cout << "\n";
}
signed main() {
ios::sync_with_stdio(false); cin.tie(0);
int t=1; //cin >> t;
while (t--) {
solve();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |