QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#638653 | #8780. Training, Round 2 | Su_Zipei | WA | 60ms | 13036kb | C++14 | 860b | 2024-10-13 16:30:21 | 2024-10-13 16:30:27 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=5010;
bitset<N> dp[N],tmpl[N],tmpr[N],tmp2,tmp;
int main(){
int n=5000,a=0,b=0;
scanf("%d%d%d",&n,&a,&b);
dp[0][0]=1;
for(int i=0;i<N;i++)
for(int j=i;j<N;j++)
tmpl[i][j]=1;
for(int i=0;i<N;i++)
for(int j=0;j<=i;j++)
tmpr[i][j]=1;
for(int i=1;i<=n;i++){
int l1=0,r1=5000,l2=0,r2=5000;
scanf("%d%d%d%d",&l1,&r1,&l2,&r2);
l1-=a;r1-=a;l2-=b;r2-=b;
l1=max(l1,0);
r1=min(r1,n);
l2=max(l2,0);
r2=min(r2,n);
tmp=tmpl[l2]&tmpr[r2];
if(l2>r2){
cout<<tmp.count()<<endl;
}
for(int j=r1;j>=l1;j--){
tmp2=dp[j]&tmp;
dp[j]|=tmp2<<1;
dp[j+1]|=tmp2;
}
}
int res=0;
for(int i=0;i<=n;i++)
for(int j=0;j<=n;j++)
if(dp[i][j])res=max(res,i+j);
printf("%d\n",res);
// printf("%.20lf\n",(double)clock()/CLOCKS_PER_SEC);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 30ms
memory: 11956kb
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: 60ms
memory: 11688kb
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: 60ms
memory: 12856kb
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: 60ms
memory: 11636kb
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: 60ms
memory: 13036kb
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: -100
Wrong Answer
time: 58ms
memory: 11296kb
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:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 3 0 0 0 0 1 0 2 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 2 0 0 0 0 0 0 0 0 2 0 0 0 3 0 0 0 0 1 0 0 0 0 0 0 2 0 ...
result:
wrong answer 1st lines differ - expected: '5', found: '0'