QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#490989#8780. Training, Round 2cppcppcpp3WA 8ms3920kbC++141.0kb2024-07-25 16:57:272024-07-25 16:57:27

Judging History

你现在查看的是最新测评结果

  • [2024-07-25 16:57:27]
  • 评测
  • 测评结果:WA
  • 用时:8ms
  • 内存:3920kb
  • [2024-07-25 16:57:27]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=5005;
const int inf=2e9+7;

static char buf[1000000],*p1=buf,*p2=buf;
#define getchar() p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++
inline int wrd(){int x=0,f=1;char c=getchar();while(c<'0' || c>'9'){if(c=='-') f=-1;c=getchar();}while(c>='0' && c<='9') {x=(x<<3)+(x<<1)+c-48;c=getchar();}return x*f;}
inline void write(int x){static char buf[20];static int len=-1;if(x<0)putchar('-'),x=-x;do buf[++len]=x%10,x/=10;while(x);while(len>=0)putchar(buf[len--]+48);}

int n,sx,sy,l[N],r[N],as;

signed main(){
	n=wrd(),sx=wrd(),sy=wrd();
	memset(r,-1,sizeof r),l[0]=r[0]=sy;
	for(int i=1;i<=n;++i){
		int lx=wrd(),rx=wrd(),ly=wrd(),ry=wrd();
		for(int j=i-1;~j;--j){
			if(sx+j<lx || sx+j>rx) continue;
			int L=max(ly,l[j]),R=min(ry,r[j]);
			if(L<=R){
				r[j]=max(r[j],R+1);
				if(l[j+1]>r[j+1]) l[j+1]=L,r[j+1]=R;
				else r[j+1]=max(r[j+1],R);
			}
		}
	}
	for(int i=0;i<=n;++i) if(l[i]<=r[i]) as=max(as,i+r[i]-sy);
	return write(as),0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3724kb

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: 8ms
memory: 3920kb

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: 7ms
memory: 3856kb

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: 7ms
memory: 3848kb

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: 7ms
memory: 3828kb

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:

7

result:

wrong answer 1st lines differ - expected: '4994', found: '7'