QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#426544 | #6806. Landlord | ucup-team2279 | AC ✓ | 2ms | 3900kb | C++20 | 662b | 2024-05-31 14:44:11 | 2024-05-31 14:44:12 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int calc(int x1,int y1,int x2,int y2,int Lx,int Ly,int Rx,int Ry){
if(x1==Lx&&y1==Ly&&x2==Rx&&y2==Ry)return 1;
if(x1==Lx&&y1<Ly&&x2==Rx&&Ry<y2)return 3;
if(x1<Lx&&y1==Ly&&Rx<x2&&Ry==y2)return 3;
return 2;
}
int main(){
int t;scanf("%d",&t);
while(t--){
int Ax1,Ay1,Ax2,Ay2,Bx1,By1,Bx2,By2;
scanf("%d%d%d%d%d%d%d%d",&Ax1,&Ay1,&Ax2,&Ay2,&Bx1,&By1,&Bx2,&By2);
int Lx=max(Ax1,Bx1),Rx=min(Ax2,Bx2);
int Ly=max(Ay1,By1),Ry=min(Ay2,By2);
if(Lx>=Rx||Ly>=Ry){
printf("3\n");
continue;
}
printf("%d\n",calc(Ax1,Ay1,Ax2,Ay2,Lx,Ly,Rx,Ry)+calc(Bx1,By1,Bx2,By2,Lx,Ly,Rx,Ry));
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3900kb
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: 0
Accepted
time: 2ms
memory: 3892kb
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 2 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:
ok 10000 lines