# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
131335 | 2019-07-17T05:11:21 Z | Just_Solve_The_Problem | Pinball (JOI14_pinball) | C++11 | 5 ms | 504 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long const int maxn = (int)1e5 + 7; int n, m; int a[maxn], b[maxn], c[maxn], d[maxn]; int used[maxn]; main() { scanf("%d %d", &m, &n); for (int i = 0; i < m; i++) { scanf("%d %d %d %d", &a[i], &b[i], &c[i], &d[i]); } if (m > 10) return 0; ll ans = 1e18; for (int mask = 0; mask < (1 << m); mask++) { ll res = 0; for (int i = 1; i <= n; i++) { used[i] = -1; } for (int i = 0; i < m; i++) { if ((mask >> i) & 1) { bool ok = 0; for (int j = a[i]; j <= b[i]; j++) { ok |= (used[j] == -1); used[j] = 0; } if (ok) used[c[i]] = -1; res += d[i]; } } int ok = 0; for (int j = 1; j <= n; j++) { ok += (used[j] == -1); } if (ok == 1) { ans = min(ans, res); } } if (ans == (ll)1e18) ans = -1; printf("%lld", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 504 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 400 KB | Output is correct |
4 | Correct | 4 ms | 376 KB | Output is correct |
5 | Correct | 4 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 5 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 504 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 400 KB | Output is correct |
4 | Correct | 4 ms | 376 KB | Output is correct |
5 | Correct | 4 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 5 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 364 KB | Output is correct |
9 | Incorrect | 2 ms | 376 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 504 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 400 KB | Output is correct |
4 | Correct | 4 ms | 376 KB | Output is correct |
5 | Correct | 4 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 5 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 364 KB | Output is correct |
9 | Incorrect | 2 ms | 376 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 504 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 400 KB | Output is correct |
4 | Correct | 4 ms | 376 KB | Output is correct |
5 | Correct | 4 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 5 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 364 KB | Output is correct |
9 | Incorrect | 2 ms | 376 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |