QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#740552 | #8780. Training, Round 2 | actor | WA | 39ms | 13136kb | C++14 | 1.8kb | 2024-11-13 10:25:46 | 2024-11-13 10:25:46 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define rep(i,l,r) for (int i = (l); i <= (r); i++)
#define per(i,r,l) for (int i = (r); i >= (l); i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define maxn(a, b) a = max(a, b)
#define minn(a, b) a = min(a, b)
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
const ll mod = 998244353;
mt19937 gen(random_device{}());
ll rp(ll a,ll b) {ll res=1%mod;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
const int N = 5043;
int n, s, t;
int xl[N], xr[N], yl[N], yr[N];
int dp[N][N];
bitset<N> f[N], pre[N], suf[N];
int main() {
scanf("%d%d%d", &n, &s, &t);
rep(i,1,n) {
scanf("%d%d%d%d", &xl[i], &xr[i], &yl[i], &yr[i]);
xl[i] -= s, xr[i] -= s;
yl[i] -= t, yr[i] -= t;
}
pre[0].set(0);
rep(i,1,n) {
pre[i]=pre[i-1];
pre[i].set(i);
}
suf[n].set(n);
per(i,n-1,0) {
suf[i]=suf[i+1];
suf[i].set(i);
}
f[0].set(0);
rep(i,1,n) {
per(j,i,0) {
if (xl[i] <= j && j <= xr[i]) {
bitset<N> tmp;
tmp.set();
int l = yl[i], r = yr[i];
if (l) tmp = tmp ^ pre[l - 1];
if (r < i) tmp = tmp ^ suf[r + 1];
tmp = tmp&f[j];
f[j] = f[j]|(tmp<<1);
f[j+1] = f[j+1]|tmp;
}
}
}
int ans = 0;
rep(i,0,n) rep(j,0,n) if (f[i][j]) {
maxn(ans, i + j);
}
printf("%d\n", ans);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 7920kb
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: 37ms
memory: 11964kb
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: 33ms
memory: 11808kb
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: 36ms
memory: 11132kb
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: 0
Accepted
time: 38ms
memory: 13136kb
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:
4994
result:
ok single line: '4994'
Test #6:
score: 0
Accepted
time: 33ms
memory: 10704kb
input:
5000 774827789 700294316 774827790 774827791 700294315 700294317 774827789 774827790 700294317 700294318 774827789 774827790 700294316 700294316 774827787 774827787 700294315 700294316 774827789 774827791 700294315 700294318 774827787 774827789 700294317 700294318 774827787 774827788 700294314 70029...
output:
5
result:
ok single line: '5'
Test #7:
score: 0
Accepted
time: 37ms
memory: 10900kb
input:
5000 700294316 774827789 700294315 700294317 774827790 774827791 700294317 700294318 774827789 774827790 700294316 700294316 774827789 774827790 700294315 700294316 774827787 774827787 700294315 700294318 774827789 774827791 700294317 700294318 774827787 774827789 700294314 700294318 774827787 77482...
output:
5
result:
ok single line: '5'
Test #8:
score: -100
Wrong Answer
time: 39ms
memory: 10956kb
input:
5000 256309650 340081224 256309647 256309649 340081224 340081227 256309645 256309650 340081226 340081229 256309652 256309652 340081219 340081220 256309645 256309655 340081222 340081226 256309646 256309648 340081221 340081225 256309651 256309654 340081219 340081221 256309651 256309653 340081219 34008...
output:
358
result:
wrong answer 1st lines differ - expected: '11', found: '358'