QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#490630 | #8780. Training, Round 2 | thomaswmy | WA | 27ms | 24136kb | C++14 | 795b | 2024-07-25 15:55:45 | 2024-07-25 15:55:45 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N=5010;
int n;
bool f[N][N];
set<int> st[N];
int main() {
scanf("%d",&n);
int a,b;
scanf("%d%d",&a,&b);
f[0][0]=1;
st[0].insert(0);
for(int i=1;i<=n;i++) {
int al,ar,bl,br;
scanf("%d%d%d%d",&al,&ar,&bl,&br);
al-=a,ar-=a,bl-=b,br-=b;
al=max(al,0),ar=min(ar,n),bl=max(bl,0),br=min(br,n);
for(int j=ar;j>=al;j--) {
set<int>::iterator it;
while((it=st[j].upper_bound(br))!=st[j].begin() && (*--it)>=bl) {
int k=*it;
st[j].erase(it);
br=k-1;
if(!f[j][k+1]) f[j][k+1]=1,st[j].insert(k+1);
if(!f[j+1][k]) f[j+1][k]=1,st[j+1].insert(k);
}
}
}
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);
printf("%d",ans);
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 4112kb
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: 20ms
memory: 15088kb
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: 13952kb
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: 24ms
memory: 4344kb
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: 27ms
memory: 24136kb
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: 24ms
memory: 4064kb
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: 25ms
memory: 4120kb
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: 0
Accepted
time: 24ms
memory: 4132kb
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:
11
result:
ok single line: '11'
Test #9:
score: 0
Accepted
time: 24ms
memory: 4116kb
input:
5000 340081224 256309650 340081224 340081227 256309647 256309649 340081226 340081229 256309645 256309650 340081219 340081220 256309652 256309652 340081222 340081226 256309645 256309655 340081221 340081225 256309646 256309648 340081219 340081221 256309651 256309654 340081219 340081226 256309651 25630...
output:
11
result:
ok single line: '11'
Test #10:
score: 0
Accepted
time: 20ms
memory: 4164kb
input:
5000 490966735 218892297 490966732 490966733 218892303 218892305 490966741 490966741 218892298 218892301 490966733 490966735 218892291 218892297 490966729 490966734 218892296 218892301 490966742 490966745 218892287 218892303 490966726 490966738 218892301 218892305 490966726 490966730 218892292 21889...
output:
21
result:
ok single line: '21'
Test #11:
score: 0
Accepted
time: 24ms
memory: 4224kb
input:
5000 218892297 490966735 218892303 218892305 490966732 490966733 218892298 218892301 490966741 490966741 218892291 218892297 490966733 490966735 218892296 218892301 490966729 490966734 218892287 218892303 490966742 490966745 218892301 218892305 490966726 490966738 218892292 218892300 490966726 49096...
output:
21
result:
ok single line: '21'
Test #12:
score: 0
Accepted
time: 24ms
memory: 4264kb
input:
5000 619930859 159808007 619930853 619930854 159808007 159808017 619930840 619930856 159808013 159808025 619930848 619930864 159807995 159808009 619930844 619930847 159808008 159808022 619930848 619930856 159807995 159808001 619930850 619930852 159808020 159808022 619930853 619930871 159807992 15980...
output:
41
result:
ok single line: '41'
Test #13:
score: 0
Accepted
time: 24ms
memory: 4196kb
input:
5000 159808007 619930859 159808007 159808017 619930853 619930854 159808013 159808025 619930840 619930856 159807995 159808009 619930848 619930864 159808008 159808022 619930844 619930847 159807995 159808001 619930848 619930856 159808020 159808022 619930850 619930852 159807992 159808024 619930853 61993...
output:
41
result:
ok single line: '41'
Test #14:
score: -100
Wrong Answer
time: 25ms
memory: 5948kb
input:
5000 974187020 583788009 974186973 974187017 583788001 583788028 974187035 974187052 583788011 583788027 974187016 974187037 583787973 583787981 974187036 974187046 583788012 583788028 974187046 974187066 583788042 583788056 974186994 974187016 583788013 583788044 974186986 974186989 583787969 58378...
output:
97
result:
wrong answer 1st lines differ - expected: '100', found: '97'