# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
493715 | 2021-12-12T17:40:15 Z | Cristian | Restore Array (RMI19_restore) | C++14 | 1 ms | 460 KB |
#include <iostream> using namespace std; const int NMAX1 = 205; int v[NMAX1], sp[NMAX1], l[NMAX1], r[NMAX1], k[NMAX1], value[NMAX1]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m, i, j, ns, b; cin >> n >> m; for(i = 1; i <= m; i++) cin >> l[i] >> r[i] >> k[i] >> value[i]; /// Subtask #1 if(n <= 18 && m <= 200) { ns = (1 << n); for(b = 0; b < ns; b++) { sp[0] = 0; for(i = 1; i <= n; i++) { sp[i] = sp[i - 1]; if((1 << (i-1)) & b) sp[i]++; } int ok = 1; for(i = 1; i <= m; i++) { if(value[i] == 0 && sp[r[i]] - sp[l[i] - 1] > r[i] - l[i] - k[i] + 1) { ok = 0; break; } if(value[i] == 1 && sp[r[i]] - sp[l[i] - 1] < r[i] - l[i] - k[i] + 2) { ok = 0; break; } } if(ok) { for(i = 1; i <= n; i++) { cout << sp[i] - sp[i-1] << ' '; } return 0; } } cout << "-1"; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 460 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 460 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |