QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#150979#6806. LandlordLFCode#WA 4ms1744kbC++141.6kb2023-08-26 14:46:472023-08-26 14:46:48

Judging History

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

  • [2023-08-26 14:46:48]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:1744kb
  • [2023-08-26 14:46:47]
  • 提交

answer

#include<cstdio>
#define int long long
bool Swap(int &a,int &b){a^=b^=a^=b;return true;}
int read(){
	char ch=getchar();int nn=0,ssss=1;
	while(ch<'0'||ch>'9'){if(ch=='-')ssss*=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){nn=nn*10+(ch-'0');ch=getchar();}
	return nn*ssss;
}
#define in1(x,y) ((x)>=x1&&(x)<=x2&&(y)>=y1&&(y)<=y2)
#define in2(x,y) ((x)>=x3&&(x)<=x4&&(y)>=y3&&(y)<=y4)
bool solve(){
	int x1=read();int y1=read();
	int x2=read();int y2=read();
	int x3=read();int y3=read();
	int x4=read();int y4=read();
	if(x1==x3&&y1==y3&&x2==y2&&x4==y4){
		puts("2");
		return true;
	}
	if(x1<x3&&x3<x4&&x4<x2&&y3<y1&&y1<y2&&y2<y4){
		puts("6");
		return true;
	}
	if(x3<x1&&x1<x2&&x2<x4&&y1<y3&&y3<y4&&y4<y2){
		puts("6");
		return true;
	}
	if(x1>x3){
		Swap(x1,x3);Swap(y1,y3);
		Swap(x2,x4);Swap(y2,y4);
	}
	if(x1<x3&&x4<x2&&y1==y3&&y2<y4){
		puts("5");
		return true;
	}
	if(x1<x3&&x4<x2&&y3<y1&&y2==y4){
		puts("5");
		return true;
	}
	if(x1<x3&&x4<x2&&y1==y3&&y2==y4){
		puts("4");
		return true;
	}
	if(y1>y3){
		Swap(x1,x3);Swap(y1,y3);
		Swap(x2,x4);Swap(y2,y4);
	}
	if(y1<y3&&y4<y2&&x3<x1&&x2==x4){
		puts("5");
		return true;
	}
	if(y1<y3&&y4<y2&&x1==x3&&x2<x4){
		puts("5");
		return true;
	}
	if(y1<y3&&y4<y2&&x1==x3&&x2==x4){
		puts("4");
		return true;
	}
	if(in2(x1,y1)&&in2(x2,y2)&&in2(x1,y2)&&in2(x2,y1)){
		puts("3");
		return true;
	}
	if(in1(x3,y3)&&in1(x4,y4)&&in1(x3,y4)&&in1(x4,y3)){
		puts("3");
		return true;
	}
	if(y2<=y3||y1>=y4||x2<=x3||x1>=x4){
		puts("3");
		return true;
	}
	puts("4");
	return true;
}
signed main(){
	int T=read();
	while(T--)solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
0 0 1 1
2 2 3 4
1 0 3 2
0 1 2 3
0 0 1 1
0 0 1 1

output:

3
4
2

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 4ms
memory: 1692kb

input:

10000
399413444 601729739 838979329 605646850
176742602 192902430 399413444 601729739
19226489 2915752 27806715 977516728
4075670 1872865 19226489 925008461
45547871 393001695 58201503 713825285
18241876 197851829 45547871 713825285
237513514 504913958 868997719 543598899
134432693 110279295 2375135...

output:

3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
4
4
4
4
4
4
4
3
3
4
3
3
4
3
3
4
3
3
4
4
3
3
5
3
3
4
3
3
5
4
3
5
4
3
3
6
3
3
4
4
5
3
3
4
3
4
3
3
3
3
3
4
3
4
3
3
3
3
4
3
3
4
3
3
4
3
3
4
3
3
4
4
3
3
5
3
3
4
4
5
3
3
4
3
4
3
3
3
3
3
4
4
4
4
4
4
4
4
3
3
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
5
6
3
4
5
...

result:

wrong answer 71st lines differ - expected: '2', found: '3'