QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#528442 | #8780. Training, Round 2 | RngBased# | WA | 25ms | 101508kb | C++17 | 1.3kb | 2024-08-23 14:13:13 | 2024-08-23 14:13:13 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pdd pair<double, double>
#define F first
#define S second
#define all(x) x.begin(), x.end()
using namespace std;
int N, X, Y, dp[5005][5005];
pii x[5005], y[5005];
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
cin >> N >> X >> Y;
for (int i = 1; i <= N; i++)
{
cin >> x[i].F >> x[i].S;
cin >> y[i].F >> y[i].S;
}
for (int i = 0; i <= N; i++)
for (int j = 0; j <= N; j++)
dp[i][j] = -1;
dp[0][0] = 0;
for (int i = 0; i < N; i++)
for (int j = 0; j < N; j++)
if (dp[i][j] >= 0)
{
if (x[i + 1].F <= X + j && X + j <= x[i + 1].S &&
y[i + 1].F <= Y + dp[i][j] && Y + dp[i][j] <= y[i + 1].S)
dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j]),
dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + 1);
else
dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
}
int ans = 0;
for (int j = 0; j <= N; j++)
if (dp[N][j] >= 0)
ans = max(ans, j + dp[N][j]);
cout << ans << '\n';
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3668kb
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: 0
Accepted
time: 25ms
memory: 101492kb
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...
output:
5000
result:
ok single line: '5000'
Test #3:
score: 0
Accepted
time: 23ms
memory: 101444kb
input:
5000 932138594 801577551 932138594 932138594 801577551 801577551 932138594 932138594 801577552 801577552 932138595 932138595 801577552 801577552 932138596 932138596 801577552 801577552 932138596 932138596 801577553 801577553 932138597 932138597 801577553 801577553 932138598 932138598 801577553 80157...
output:
5000
result:
ok single line: '5000'
Test #4:
score: 0
Accepted
time: 19ms
memory: 101508kb
input:
5000 76836128 716580777 76836128 76836128 716580777 716580777 76836129 76836129 716580777 716580777 76836130 76836130 716580777 716580777 76836131 76836131 716580777 716580777 76836131 76836131 716580778 716580778 76836131 76836131 716580779 716580779 76836131 76836131 716580780 716580780 76836128 7...
output:
4994
result:
ok single line: '4994'
Test #5:
score: -100
Wrong Answer
time: 15ms
memory: 101444kb
input:
5000 716580777 76836128 716580777 716580777 76836128 76836128 716580777 716580777 76836129 76836129 716580777 716580777 76836130 76836130 716580777 716580777 76836131 76836131 716580778 716580778 76836131 76836131 716580779 716580779 76836131 76836131 716580780 716580780 76836131 76836131 716580778 ...
output:
7
result:
wrong answer 1st lines differ - expected: '4994', found: '7'