QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#490913 | #8780. Training, Round 2 | yqh2025 | WA | 25ms | 197152kb | C++14 | 1.2kb | 2024-07-25 16:42:37 | 2024-07-25 16:42:39 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=5010;
int n,a,b;
int la[N],ra[N],lb[N],rb[N];
int f[N][N];
set<int>s[N];
void solve(int l,int r,int id){
set<int>::iterator it=s[id].lower_bound(l);
vector<int>ve;
for(;it!=s[id].end()&&(*it)<=r;it++){
int x=*it;ve.push_back(x+1);
f[id][x+1]=f[id+1][x]=1;
s[id+1].insert(x);
}
while(1){
it=s[id].lower_bound(l);
if(it==s[id].end())break;
if((*it)>r)break;
s[id].erase(*it);
}
for(int x:ve)s[id].insert(x);
}
signed main(){
scanf("%lld%lld%lld",&n,&a,&b);
for(int i=1;i<=n;i++){
scanf("%lld%lld%lld%lld",&la[i],&ra[i],&lb[i],&rb[i]);
la[i]-=a,ra[i]-=a,lb[i]-=b,rb[i]-=b;
la[i]=max(la[i],0ll),ra[i]=max(ra[i],0ll);
lb[i]=max(lb[i],0ll),rb[i]=max(rb[i],0ll);
la[i]=min(la[i],n),ra[i]=min(ra[i],n);
lb[i]=min(lb[i],n),rb[i]=min(rb[i],n);
}
f[0][0]=1;s[0].insert(0);
for(int t=1;t<=n;t++){
for(int i=la[t];i<=ra[t];i++){
solve(lb[t],rb[t],i);
}
// for(int i=0;i<=n;i++){
// for(int j=0;j<=n;j++){
// cout<<f[i][j]<<" ";
// }
// cout<<endl;
// }
// cout<<endl;
}
int ans=0;
for(int i=0;i<=n;i++){
for(int j=0;j<=n;j++){
if(f[i][j])ans=max(ans,i+j);
}
}
cout<<ans;
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3840kb
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: 18ms
memory: 106736kb
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: 25ms
memory: 98456kb
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: 21ms
memory: 4320kb
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: 23ms
memory: 197152kb
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:
4997
result:
wrong answer 1st lines differ - expected: '4994', found: '4997'