QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#490973 | #8780. Training, Round 2 | czc | WA | 17ms | 6088kb | C++23 | 819b | 2024-07-25 16:53:54 | 2024-07-25 16:53:54 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int n,a,b;
int vis[5005][5005];
set<int> st[5005];
int main(){
scanf("%d%d%d",&n,&a,&b);
vis[0][0]=1;
st[0].insert(0);
for(int i=1;i<=n;i++){
int la,ra,lb,rb;
scanf("%d%d%d%d",&la,&ra,&lb,&rb);
la-=a,ra-=a,lb-=b,rb-=b;
for(int j=max(0,la);j<=min(n,ra);j++){
auto it=st[j].lower_bound(lb);
for(auto it2=it;it2!=st[j].end() && *it2<=rb; ){
int x=i,y=*it2;
it2=st[j].erase(it2);
if(n==5000){
cout<<x+1<<" "<<y<<endl;
cout<<x<<" "<<y+1<<endl;
}
if(!vis[x+1][y]) vis[x+1][y]=1,st[x+1].insert(y);
if(!vis[x][y+1]) vis[x][y+1]=1,st[x].insert(y+1);
}
}
}
int ans=0;
for(int i=0;i<=n;i++){
for(int j=0;j<=n;j++){
if(vis[i][j]) ans=max(ans,i+j);
}
}
printf("%d",ans);
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 5912kb
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: 17ms
memory: 6088kb
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:
2 0 1 1 4 1 3 2 5
result:
wrong answer 1st lines differ - expected: '5000', found: '2 0'