QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#490935 | #8780. Training, Round 2 | czc | WA | 17ms | 4052kb | C++23 | 734b | 2024-07-25 16:47:49 | 2024-07-25 16:47:51 |
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(!vis[x+1][y]) vis[x+1][y]=1,st[x+1].insert(y+1);
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;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 4032kb
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: 4052kb
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:
5
result:
wrong answer 1st lines differ - expected: '5000', found: '5'