QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#261520 | #6806. Landlord | chengch | AC ✓ | 13ms | 3428kb | C++17 | 744b | 2023-11-22 22:45:33 | 2023-11-22 22:45:34 |
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(){
// freopen("data.in","r",stdin);
// freopen("cch.out","w",stdout);
ios::sync_with_stdio(0);cin.tie(0);
int t;cin>>t;
while(t--){
int Ax1,Ay1,Ax2,Ay2;cin>>Ax1>>Ay1>>Ax2>>Ay2;
int Bx1,By1,Bx2,By2;cin>>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){
cout<<3<<endl;
continue;
}
cout<<calc(Ax1,Ay1,Ax2,Ay2,Lx,Ly,Rx,Ry)+calc(Bx1,By1,Bx2,By2,Lx,Ly,Rx,Ry)<<endl;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3428kb
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: 13ms
memory: 3384kb
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