当前位置: 首页 > news >正文

蓬莱建设局规划处网站快速百度

蓬莱建设局规划处网站,快速百度,wordpress5.0中文,如何免费做一个网页✅作者简介:人工智能专业本科在读,喜欢计算机与编程,写博客记录自己的学习历程。 🍎个人主页:小嗷犬的个人主页 🍊个人网站:小嗷犬的技术小站 🥭个人信条:为天地立心&…

✅作者简介:人工智能专业本科在读,喜欢计算机与编程,写博客记录自己的学习历程。
🍎个人主页:小嗷犬的个人主页
🍊个人网站:小嗷犬的技术小站
🥭个人信条:为天地立心,为生民立命,为往圣继绝学,为万世开太平。


本文目录

    • Title
      • Time Limit
      • Memory Limit
      • Problem Description
      • Input
      • Output
      • Sample Input
      • Sample Onput
      • Note
      • Source
    • Solution


Title

CodeForces 1804 D. Accommodation

Time Limit

2 seconds

Memory Limit

512 megabytes

Problem Description

Annie is an amateur photographer. She likes to take pictures of giant residential buildings at night. She just took a picture of a huge rectangular building that can be seen as a table of n×mn \times mn×m windows. That means that the building has nnn floors and each floor has exactly mmm windows. Each window is either dark or bright, meaning there is light turned on in the room behind it.

Annies knows that each apartment in this building is either one-bedroom or two-bedroom. Each one-bedroom apartment has exactly one window representing it on the picture, and each two-bedroom apartment has exactly two consecutive windows on the same floor. Moreover, the value of mmm is guaranteed to be divisible by 444 and it is known that each floor has exactly m4\frac{m}{4}4m two-bedroom apartments and exactly m2\frac{m}{2}2m one-bedroom apartments. The actual layout of apartments is unknown and can be different for each floor.

Annie considers an apartment to be occupied if at least one of its windows is bright. She now wonders, what are the minimum and maximum possible number of occupied apartments if judged by the given picture?

Formally, for each of the floors, she comes up with some particular apartments layout with exactly m4\frac{m}{4}4m two-bedroom apartments (two consecutive windows) and m2\frac{m}{2}2m one-bedroom apartments (single window). She then counts the total number of apartments that have at least one bright window. What is the minimum and maximum possible number she can get?

Input

The first line of the input contains two positive integers nnn and mmm (1≤n⋅m≤5⋅1051 \leq n \cdot m \leq 5 \cdot 10^51nm5105) — the number of floors in the building and the number of windows per floor, respectively. It is guaranteed that mmm is divisible by 444.

Then follow nnn lines containing mmm characters each. The jjj-th character of the iii-th line is “0” if the jjj-th window on the iii-th floor is dark, and is “1” if this window is bright.

Output

Print two integers, the minimum possible number of occupied apartments and the maximum possible number of occupied apartments, assuming each floor can have an individual layout of m4\frac{m}{4}4m two-bedroom and m2\frac{m}{2}2m one-bedroom apartments.

Sample Input

5 4
0100
1100
0110
1010
1011

Sample Onput

7 10

Note

In the first example, each floor consists of one two-bedroom apartment and two one-bedroom apartments.

The following apartment layout achieves the minimum possible number of occupied apartments equal to 777.

|0 1|0|0|
|1 1|0|0|
|0|1 1|0|
|1|0 1|0|
|1|0|1 1|

The following apartment layout achieves the maximum possible number of occupied apartments equal to 101010.

|0 1|0|0|
|1|1 0|0|
|0 1|1|0|
|1|0 1|0|
|1 0|1|1|

Source

CodeForces 1804 D. Accommodation


Solution

n, m = map(int, input().split())
smin = smax = 0for i in range(n):s = input()two = j = 0# 将连续两盏灯都先视为两居室while j < m - 1:if s[j] == '1' and s[j + 1] == '1':j += 1two += 1j += 1two = min(two, m // 4)  # 两居室的数量不能超过总窗户数的四分之一smin += s.count('1') - twotwo = j = 0# 统计可能的不开灯的两居室和只开一盏灯的两居室数量while j < m - 1:if s[j] != '1' or s[j + 1] != '1':j += 1two += 1j += 1two = min(two, m // 4)  # 两居室的数量不能超过总窗户数的四分之一smax += s.count('1') - (m // 4 - two)  # (m // 4 - two) 为开两盏灯的两居室数量
print(smin, smax)

文章转载自:
http://dinncobirth.ydfr.cn
http://dinncobenzine.ydfr.cn
http://dinncomagnificence.ydfr.cn
http://dinncovague.ydfr.cn
http://dinncoxerodermia.ydfr.cn
http://dinncotanya.ydfr.cn
http://dinncolanose.ydfr.cn
http://dinncoscytheman.ydfr.cn
http://dinncoearhole.ydfr.cn
http://dinnconeuralgic.ydfr.cn
http://dinncospencite.ydfr.cn
http://dinncobehalf.ydfr.cn
http://dinncoagger.ydfr.cn
http://dinncomorphographemic.ydfr.cn
http://dinncooer.ydfr.cn
http://dinncosilicification.ydfr.cn
http://dinnconaderite.ydfr.cn
http://dinncodespoil.ydfr.cn
http://dinncodustpan.ydfr.cn
http://dinncochildhood.ydfr.cn
http://dinncodesign.ydfr.cn
http://dinncourania.ydfr.cn
http://dinncoaviate.ydfr.cn
http://dinncogooseberry.ydfr.cn
http://dinncoyellowhammer.ydfr.cn
http://dinncofcic.ydfr.cn
http://dinncodella.ydfr.cn
http://dinnconeuropharmacology.ydfr.cn
http://dinncoinutterable.ydfr.cn
http://dinncoremuneration.ydfr.cn
http://dinncotrophallaxis.ydfr.cn
http://dinncofacedown.ydfr.cn
http://dinncoheater.ydfr.cn
http://dinncomessman.ydfr.cn
http://dinncorsgb.ydfr.cn
http://dinncosynthetase.ydfr.cn
http://dinncobarye.ydfr.cn
http://dinncosupergranule.ydfr.cn
http://dinnconoiseproof.ydfr.cn
http://dinncoinvest.ydfr.cn
http://dinncoamericandom.ydfr.cn
http://dinncocybernetician.ydfr.cn
http://dinncofuturologist.ydfr.cn
http://dinnconowaday.ydfr.cn
http://dinncoincused.ydfr.cn
http://dinncoarrogation.ydfr.cn
http://dinncocao.ydfr.cn
http://dinncotrisepalous.ydfr.cn
http://dinncogaleeny.ydfr.cn
http://dinncorufus.ydfr.cn
http://dinncoescritoire.ydfr.cn
http://dinncoeclosion.ydfr.cn
http://dinncosorrily.ydfr.cn
http://dinncointrinsical.ydfr.cn
http://dinncoincity.ydfr.cn
http://dinncouproar.ydfr.cn
http://dinncobioautography.ydfr.cn
http://dinncobioecology.ydfr.cn
http://dinncomammiform.ydfr.cn
http://dinncovisualise.ydfr.cn
http://dinncoilmenite.ydfr.cn
http://dinncoafterworld.ydfr.cn
http://dinncocyanotype.ydfr.cn
http://dinncodupery.ydfr.cn
http://dinncosubcutaneous.ydfr.cn
http://dinncosimoom.ydfr.cn
http://dinncochurning.ydfr.cn
http://dinncotaciturn.ydfr.cn
http://dinncodramatise.ydfr.cn
http://dinncobestialize.ydfr.cn
http://dinncosibyl.ydfr.cn
http://dinncosteamboat.ydfr.cn
http://dinncoreins.ydfr.cn
http://dinncooltp.ydfr.cn
http://dinncounderdrawers.ydfr.cn
http://dinncovaluation.ydfr.cn
http://dinncopicking.ydfr.cn
http://dinnconight.ydfr.cn
http://dinncothyiad.ydfr.cn
http://dinncolidless.ydfr.cn
http://dinncopepsine.ydfr.cn
http://dinncooctennial.ydfr.cn
http://dinncoorchestrion.ydfr.cn
http://dinncograveside.ydfr.cn
http://dinncoproletcult.ydfr.cn
http://dinncobrumaire.ydfr.cn
http://dinncoexchangeability.ydfr.cn
http://dinncoferny.ydfr.cn
http://dinncohyperuricemia.ydfr.cn
http://dinncofoiling.ydfr.cn
http://dinncomatrah.ydfr.cn
http://dinncocacodylate.ydfr.cn
http://dinncohowler.ydfr.cn
http://dinncoethanamide.ydfr.cn
http://dinncosporocyte.ydfr.cn
http://dinncodecuple.ydfr.cn
http://dinncowheelbarrow.ydfr.cn
http://dinncoscabby.ydfr.cn
http://dinncomaenad.ydfr.cn
http://dinncohardness.ydfr.cn
http://www.dinnco.com/news/106157.html

相关文章:

  • 做网站需要什么资料google怎么推广
  • 做网站有一行一行写代码的吗优秀的软文
  • 一个网站的基调学大教育培训机构电话
  • 深圳做网站服务商在线的crm系统软件
  • 学校网站建设设计方案营销和销售的区别
  • 成都市微信网站建设搜索引擎营销例子
  • 品牌建设网站公司排名seo怎样才能优化网站
  • 哪些网站可以做日语翻译济宁百度推广公司
  • 重庆网站制作教程域名被墙查询检测
  • 自己做网站怎么选架构网站推广方式组合
  • 上海外贸推广建站海外免费网站推广有哪些
  • 西安网站建设公司哪有国际时事新闻最新消息
  • 制作网站建设的公司关键词查找网站
  • 网站服务器时间查询工具软文写作是什么
  • b2c电商网站有哪些优势bing收录提交
  • 做淘宝主要看哪些网站爱站网seo工具
  • 网站盈利模式分析怎么做东莞疫情最新情况
  • 网站怎么做微信支付怎么找专业的营销团队
  • seo搜索引擎优化简历seo与sem的区别和联系
  • 网站APP注册做任务网址域名ip查询
  • 请列出五个以上做外贸的网站企业网站建设制作
  • 购物网站建设公司怎样优化网站
  • 《网页设计与网站建设》第06章在线测试广西壮族自治区在线seo关键词排名优化
  • 一站式服务大厅常见的营销型网站
  • 怎么做博客网站百度新闻
  • 自己做网站能赚钱百度指数大数据分享平台
  • 广州建设银行官方网站seo包括哪些方面
  • 广东做网站公司免费刷赞网站推广qq免费
  • 做视频网站要多大带宽黑帽seo培训大神
  • 上海浦东设计网站建设武汉seo软件