#include <bits/stdc++.h>
using namespace std;
#define TRACE(x) cerr << #x << " :: " << x << endl
#define _ << " " <<
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(),(x).end()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for (int i=(a);i>=(b);--i)
using ll=long long;
const int mxN = 1e5+5;
const int mod = 1e9+7;
const int mxM = 205;
int N, M, L[mxM], R[mxM], K[mxM], V[mxM];
int A[mxN], pA[mxN];
int main() {
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
cin >> N >> M;
FOR(i,0,M-1){
cin >> L[i] >> R[i] >> K[i] >> V[i];
}
FOR(i,0,(1<<N)-1){
FOR(j,0,N-1) {
A[j] = (i&(1<<j)) > 0;
pA[j] = (A[j] == 0) + (j > 0 ? pA[j-1] : 0);
}
bool ok = 1;
FOR(i,0,M-1){
if (V[i] == 0) {
ok &= (pA[R[i]]-(L[i]>0?pA[L[i]-1]:0)) >= K[i];
} else {
ok &= (pA[R[i]]-(L[i]>0?pA[L[i]-1]:0)) < K[i];
}
}
if (ok) {
FOR(j,0,N-1){ cout << A[j] << ' '; }
cout << '\n';
return 0;
}
}
cout << -1 << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
35 ms |
384 KB |
Output is correct |
4 |
Correct |
21 ms |
384 KB |
Output is correct |
5 |
Correct |
89 ms |
384 KB |
Output is correct |
6 |
Correct |
49 ms |
384 KB |
Output is correct |
7 |
Correct |
17 ms |
384 KB |
Output is correct |
8 |
Correct |
25 ms |
384 KB |
Output is correct |
9 |
Correct |
83 ms |
384 KB |
Output is correct |
10 |
Correct |
0 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
35 ms |
384 KB |
Output is correct |
4 |
Correct |
21 ms |
384 KB |
Output is correct |
5 |
Correct |
89 ms |
384 KB |
Output is correct |
6 |
Correct |
49 ms |
384 KB |
Output is correct |
7 |
Correct |
17 ms |
384 KB |
Output is correct |
8 |
Correct |
25 ms |
384 KB |
Output is correct |
9 |
Correct |
83 ms |
384 KB |
Output is correct |
10 |
Correct |
0 ms |
384 KB |
Output is correct |
11 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
12 |
Halted |
0 ms |
0 KB |
- |