QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#606656 | #8780. Training, Round 2 | 333zhan | TL | 0ms | 3572kb | C++20 | 1.4kb | 2024-10-03 11:16:08 | 2024-10-03 11:16:08 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
using namespace std;
void solve () {
int n, a, b;
cin >> n >> a >> b;
vector dp (n + 1, vector <int> (n + 1));
dp[0][0] = 1;
for (int w = 0; w < n; w ++) {
int al, ar, bl, br;
cin >> al >> ar >> bl >> br;
al = max (al, a);
ar = min (ar, a + n - 1);
bl = max (bl, b);
br = min (br, b + n - 1);
al -= a;
ar -= a;
bl -= b;
br -= b;
auto ndp = dp;
for (int i = al; i <= ar + 1; i ++) {
for (int j = bl; j <= br + 1; j ++) {
if (i == al && j == bl) {
continue;
}
if (i > al) {
ndp[i][j] |= dp[i - 1][j];
}
if (j > bl) {
ndp[i][j] |= dp[i][j - 1];
}
}
}
dp = move (ndp);
}
int maxx = 0;
for (int i = 0; i <= n; i ++) {
for (int j = 0; j <= n; j ++) {
if (dp[i][j]) {
maxx = max (maxx, i + j);
}
}
}
cout << maxx << '\n';
}
signed main () {
ios::sync_with_stdio (false);
cin.tie (nullptr);
int T = 1;
// cin >> T;
while (T --) {
solve ();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3572kb
input:
3 0 0 0 1 0 1 1 1 0 1 1 1 1 1
output:
3
result:
ok single line: '3'
Test #2:
score: -100
Time Limit Exceeded
input:
5000 801577551 932138594 801577551 801577551 932138594 932138594 801577552 801577552 932138594 932138594 801577552 801577552 932138595 932138595 801577552 801577552 932138596 932138596 801577553 801577553 932138596 932138596 801577553 801577553 932138597 932138597 801577553 801577553 932138598 93213...