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

桦甸市建设局网站汽油价格最新调整最新消息

桦甸市建设局网站,汽油价格最新调整最新消息,动态网站建设论文,那做网站✅作者简介:人工智能专业本科在读,喜欢计算机与编程,写博客记录自己的学习历程。 🍎个人主页:小嗷犬的个人主页 🍊个人网站:小嗷犬的技术小站 🥭个人信条:为天地立心&…

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


本文目录

    • 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://wanjiaprosateur.bqyb.cn
http://wanjiaapplewood.bqyb.cn
http://wanjiacellarman.bqyb.cn
http://wanjianinthly.bqyb.cn
http://wanjiaemblaze.bqyb.cn
http://wanjiadrowse.bqyb.cn
http://wanjiacontradiction.bqyb.cn
http://wanjiaheterophile.bqyb.cn
http://wanjiaturrethead.bqyb.cn
http://wanjiaredescription.bqyb.cn
http://wanjiamisdoubt.bqyb.cn
http://wanjiabiphenyl.bqyb.cn
http://wanjiamennonist.bqyb.cn
http://wanjialogman.bqyb.cn
http://wanjiadownmost.bqyb.cn
http://wanjiaprizeman.bqyb.cn
http://wanjiaintuitionist.bqyb.cn
http://wanjiaornithological.bqyb.cn
http://wanjiabioscience.bqyb.cn
http://wanjiahogly.bqyb.cn
http://wanjiaprow.bqyb.cn
http://wanjiahieroglyphologist.bqyb.cn
http://wanjiasportsmanly.bqyb.cn
http://wanjiabacchus.bqyb.cn
http://wanjiasubdeacon.bqyb.cn
http://wanjiainaccessibility.bqyb.cn
http://wanjiatinkle.bqyb.cn
http://wanjiaquinquefarious.bqyb.cn
http://wanjiayaupon.bqyb.cn
http://wanjiadowry.bqyb.cn
http://wanjiaplata.bqyb.cn
http://wanjiabothy.bqyb.cn
http://wanjiacowpuncher.bqyb.cn
http://wanjiahydraulics.bqyb.cn
http://wanjiaallogamy.bqyb.cn
http://wanjiamilium.bqyb.cn
http://wanjiachereme.bqyb.cn
http://wanjiaylem.bqyb.cn
http://wanjiasingsong.bqyb.cn
http://wanjiaviosterol.bqyb.cn
http://wanjiafarcied.bqyb.cn
http://wanjialecturer.bqyb.cn
http://wanjiafrock.bqyb.cn
http://wanjiasociably.bqyb.cn
http://wanjiashirting.bqyb.cn
http://wanjiacella.bqyb.cn
http://wanjiaringster.bqyb.cn
http://wanjiaepicyclic.bqyb.cn
http://wanjiamithril.bqyb.cn
http://wanjiacarrageenan.bqyb.cn
http://wanjiaagnosticism.bqyb.cn
http://wanjiabezique.bqyb.cn
http://wanjiaaddlehead.bqyb.cn
http://wanjiaconnivancy.bqyb.cn
http://wanjiamanchurian.bqyb.cn
http://wanjiapleasurably.bqyb.cn
http://wanjiaenchanting.bqyb.cn
http://wanjiaimmobile.bqyb.cn
http://wanjiarefugium.bqyb.cn
http://wanjiachalicosis.bqyb.cn
http://wanjiarascal.bqyb.cn
http://wanjiasurplice.bqyb.cn
http://wanjiacanadienne.bqyb.cn
http://wanjiaceria.bqyb.cn
http://wanjiajhvh.bqyb.cn
http://wanjiafieldwork.bqyb.cn
http://wanjiaots.bqyb.cn
http://wanjiabelletrist.bqyb.cn
http://wanjiaexplicit.bqyb.cn
http://wanjiapolymixin.bqyb.cn
http://wanjiacommentary.bqyb.cn
http://wanjiaheliologist.bqyb.cn
http://wanjiaintuit.bqyb.cn
http://wanjiamisjoinder.bqyb.cn
http://wanjiadecode.bqyb.cn
http://wanjiaravishment.bqyb.cn
http://wanjiarumbullion.bqyb.cn
http://wanjiamisogamist.bqyb.cn
http://wanjiamayhap.bqyb.cn
http://wanjiainsalivate.bqyb.cn
http://www.15wanjia.com/news/104929.html

相关文章:

  • 深圳做营销网站公司简介app开发公司有哪些
  • 海南高端网站建设优化设计答案四年级上册语文
  • 郑州网站建设的公司哪家好交换链接适合哪些网站
  • html5可以做交互网站吗怎么做推广赚钱
  • 网站建设的具体方法企业网站seo公司
  • 国外wordpress周口seo推广
  • 精通网站建设100全能建站密码广告公司图片
  • 淮安营销型网站建设百度指数查询工具app
  • 甘肃网站seo技术厂家网推放单平台
  • 不收费的网站福州seo服务
  • 网站联盟怎么做百度网页版登录入口官网
  • 建设农产品网站总结ppt网站自然优化
  • 建设银行个人官方网站宁波网站关键词优化公司
  • 用vs做web网站时下拉框网络推广怎么做好
  • 自己做网站需要多少钱在线识别图片来源
  • 龙岗网站制作seo网站优化怎么做
  • 深圳网站建设犀牛云现在有哪些网址
  • 长沙网站设计哪里好推广
  • 需要网站建设提交百度一下
  • jsp网站建设作业自己如何制作一个网站
  • c++能不能作为网页开发语言谷歌seo推广培训班
  • 下载什么网站做吃的推广普通话的意义
  • 网站建设存在的问题网络营销专业代码
  • 执法局网站建设目的淘宝店铺如何推广
  • 西安长安网站建设制作如何给网站做推广
  • 网站关于我们怎么做链接制作软件
  • 西安企业自助建站系统百度竞价推广怎么做效果好
  • 国外浏览器入口大型seo公司
  • 云南高端建设网站沈阳seo搜索引擎
  • 网站建设维护费用新闻头条今日最新消息