QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#590419 | #8780. Training, Round 2 | mzyx | WA | 143ms | 3704kb | C++20 | 1.6kb | 2024-09-26 00:01:23 | 2024-09-26 00:01:24 |
Judging History
answer
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
constexpr int N = 5000 + 10;
constexpr int lim = 5000;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
int n, I, T;
cin >> n >> I >> T;
// vector dp(n + 1, vector<set<int>> (n + 1));
vector<set<int>> dp(n + 1);
dp[0].insert(I);
auto in = [&](int x, int l, int r) -> bool {
if (x >= l && x <= r) {
return true;
}
return false;
};
for (int i = 1; i <= n; i++) {
int il, ih, tl, th;
cin >> il >> ih >> tl >> th;
vector<set<int>> idp(n + 1);
// [il, ih] [tl, th]
for (int s = 0; s <= i; s++) {
for (auto x : dp[s]) {
int y = I + T + s - x;
idp[s].insert(x);
}
if (s > 0) {
for (auto x : dp[s - 1]) {
int y = I + T + s - 1 - x;
// cerr << x << " " << y << "\n";
if (in(x, il, ih) && in(y, tl, th)) {
idp[s].insert(x);
}
if (in(x, il, ih) && in(y, tl, th)) {
idp[s].insert(x + 1);
}
if (idp.size() >= lim) {
break;
}
}
}
}
dp = idp;
}
for (int i = n; i >= 0; i--) {
if (!dp[i].empty()) {
cout << i << "\n";
break;
}
}
// for (int i = 1; i <= n; i++) {
// for (int s = 1; s <= i; s++) {
// cerr << "i: " << i << " | " << "s: " << s << "\n";
// for (auto x : dp[i][s]) {
// cerr << x << " \n"[x == *dp[i][s].rbegin()];
// }
// }
// }
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3460kb
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
Wrong Answer
time: 143ms
memory: 3704kb
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:
1
result:
wrong answer 1st lines differ - expected: '5000', found: '1'