QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#590403 | #8780. Training, Round 2 | mzyx | Compile Error | / | / | C++20 | 2.5kb | 2024-09-25 23:56:06 | 2024-09-25 23:56:06 |
Judging History
This is the latest submission verdict.
- [2024-09-25 23:56:06]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-09-25 23:56:06]
- Submitted
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;
inline in(int x, int l, int r) {
if (x >= l && x <= r) {
return true;
}
return false;
}
// 注意,在当前较新的 C++ 版本中,使用 getchar() 的快读是无意义的,只有使用 fread() 的才能提速
namespace QuickRead { // 快读
char buf[1 << 21], *p1 = buf, *p2 = buf;
inline int getc() {
return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++;
}
template <typename T> void Cin(T &a) {
T ans = 0;
bool f = 0;
char c = getc();
for (; c < '0' || c > '9'; c = getc()) {
if (c == '-') f = 1;
}
for (; c >= '0' && c <= '9'; c = getc()) {
ans = ans * 10 + c - '0';
}
a = f ? -ans : ans;
}
template <typename T, typename... Args> void Cin(T &a, Args &...args) {
Cin(a), Cin(args...);
}
template <typename T> void write(T x) { // 注意,这里输出不带换行
if (x < 0) putchar('-'), x = -x;
if (x > 9) write(x / 10);
putchar(x % 10 + '0');
}
} // namespace QuickRead
using namespace QuickRead;
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);
Cin(I);
Cin(T);
// vector dp(n + 1, vector<set<int>> (n + 1));
vector<set<int>> dp(n + 1);
dp[0].insert(I);
for (int i = 1; i <= n; i++) {
int il, ih, tl, th;
Cin(il);
Cin(ih);
Cin(tl);
Cin(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);
idp[s].insert(x + 1);
}
}
}
}
dp = idp;
}
for (int i = n; i >= 0; i--) {
if (!dp[i].empty()) {
write(i);
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
answer.code:12:8: error: ISO C++ forbids declaration of ‘in’ with no type [-fpermissive] 12 | inline in(int x, int l, int r) { | ^~