当前位置:网站首页>AcWing 1749. Block billboard II (classified discussion + enumeration)
AcWing 1749. Block billboard II (classified discussion + enumeration)
2022-04-21 10:46:00 【Old worry】
subject :1749. Block billboards II


Answer key : The last part not covered , Project to x Axis and y The length on the shaft , Multiplication is the answer . Equivalent to finding... In the uncovered part x Maximum on shaft 、 Small value .y So is the shaft . Multiply the two . Note that if it's covered , You can't find the maximum or minimum value , So remember and 0 Compare
#include<bits/stdc++.h>
#define x first
#define y second
using namespace std;
typedef long long LL;
typedef pair<int ,int> PII;
const int N=1e5+10;
const int mod=100000007;
bool sta[2050][2050];
int main(){
int a[3][4];
int sum=0;
for(int i=0;i<2;i++){
cin>>a[i][0]>>a[i][1]>>a[i][2]>>a[i][3];
}
for(int k=0;k<2;k++){
for(int i=a[k][0]+1000;i<a[k][2]+1000;i++){
for(int j=a[k][1]+1000;j<a[k][3]+1000;j++){
if(k==0){
sta[i][j]=1;
}else{
sta[i][j]=0;
}
}
}
}
int b=2050,c=2050,d=0,e=0;//b、d Record x Minimum on shaft 、 Great value .c,e Record y Minimum on shaft 、 Great value
for(int i=a[0][0]+1000;i<a[0][2]+1000;i++){
for(int j=a[0][1]+1000;j<a[0][3]+1000;j++){
if(sta[i][j]){
b=min(b,i),d=max(d,i);
c=min(c,j),e=max(e,j);
}
}
}
cout<<max(0,d-b+1)*max(0,e-c+1);// Pay attention to the situation where they are covered
return 0;
}
版权声明
本文为[Old worry]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204211037589202.html
边栏推荐
猜你喜欢

TypeError: The view function did not return a valid response. The function either returned none

活动报名 | 如何基于开源项目 Tapdata PDK,快速完成数据源和目标的开发?

2022 information and future preparation topic 2 new online judge 1113: digit problem

zsh: segmentation fault 解决方法

基于润和大禹开发板的导购系统项目方案

Uniapp wechat applet clicks the button to call wechat payment

再战leetcode (392.判断子序列)

Project scheme of shopping guide system based on Runhe Dayu development board

MKL and vs2019 configuration method

00000000000000000000000
随机推荐
Recursive function C language question type
Pytoch learning notes (2) examples of univariate linear regression and calculation diagram
Pytoch learning notes (3) torch Autograd, logistic regression model, training
使用对数器验证简单排序
Vulnhub PRIME: 1
8通道CAN FD,更强大的数据记录仪GL3400
Zsh: segmentation fault solution
递归函数 C语言 题型
页面导航-声明式/编程式导航
本地IP地址使用域名访问
【天梯赛】L3-005 垃圾箱分布(堆优化版dijkstra)
GO函数的使用
Map与JsonObject区别
"Air washing" meets the iteration again, and the imitator has a new goal
00000000000000000000000
Oracle密码过期问题,设置永不过期
Pytoch learning notes (1) check the creation of torch, CUDA and tensor
A collection of econometric models and empirical Stata codes, with top publication examples
L1-045 cosmic invincible greeting (5 points)
The prospectus of quwan group is "invalid", and its TT voice has been taken off the shelf. How to achieve stable growth?