QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#462519 | #8780. Training, Round 2 | ucup-team3519# | WA | 37ms | 101700kb | C++20 | 1.3kb | 2024-07-03 20:33:14 | 2024-07-03 20:33:15 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define V vector
#define pb push_back
#define fi first
#define se second
#define lb lower_bound
#define all0(x) (x).begin(), (x).end()
#define all1(x) (x).begin() + 1, (x).end()
typedef pair<int, int> pi;
typedef long long LL;
typedef double db;
const int INF = 2e9 + 10;
const LL INFLL = 8e18 + 10;
void solve() {
int n; cin >> n;
int a, b; cin >> a >> b;
V<set<int>> st(n + 1);
V<V<int>> used(n + 1, V<int>(n + 1));
used[0][0] = 1;
st[0].insert(0);
for(int i = 1; i <= n; i++) {
int a0, a1, b0, b1; cin >> a0 >> a1 >> b0 >> b1;
a0 -= a, a1 -= a, b0 -= b, b1 -= b;
for(int i = max(a0, 0); i <= min(n, a1); i++) {
auto it = st[i].lb(b0);
while(it != st[i].end() && *it <= b1) {
if(!used[i][*it + 1]) st[i].insert(*it + 1), used[i][*it + 1] = 1;
if(!used[i + 1][*it]) st[i + 1].insert(*it), used[i + 1][*it] = 1;
it = st[i].erase(it);
}
}
}
int ans = 0;
for(int i = 0; i <= n; i++) {
for(int j = 0; j <= n; j++) {
if(used[i][j]) ans = max(ans, i + j);
}
}
cout << ans << endl;
}
int main() {
solve();
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3600kb
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: 32ms
memory: 101636kb
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: 37ms
memory: 101612kb
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: -100
Wrong Answer
time: 32ms
memory: 101700kb
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:
4997
result:
wrong answer 1st lines differ - expected: '4994', found: '4997'