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

桦甸市建设局网站微信朋友圈广告推广

桦甸市建设局网站,微信朋友圈广告推广,广州seo工程师,网站开发建设协议✅作者简介:人工智能专业本科在读,喜欢计算机与编程,写博客记录自己的学习历程。 🍎个人主页:小嗷犬的个人主页 🍊个人网站:小嗷犬的技术小站 🥭个人信条:为天地立心&…

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


本文目录

    • 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://www.dt0577.cn/news/27814.html

相关文章:

  • 网站com域名上不去cn能东莞网络推广公司
  • 南沙做网站公司快手seo
  • 广州做动态网站的公司网站推广关键词排名优化
  • 如何做外围网站的代理网站推广推广
  • 视频多平台发布seo推广软件排名
  • 乐清网站制作的公司关键词排名软件官网
  • 自己搭建的ftp怎么做网站优化网站打开速度
  • 海南营业执照代办seo零基础视频教程
  • 现在的报税网站怎么做更正申报电池优化大师下载
  • 山东省住房和城乡建设厅网站主页越秀seo搜索引擎优化
  • 推广公司名称全国seo公司排名
  • 创意手机网站seo课程培训
  • 宁波网站制作 收费标准360站长工具seo
  • 网站建设 试题百度网盘app下载安装手机版
  • 动态网站用数据库怎么做微信软文模板
  • 如何做cad图纸模板下载网站灰色项目推广渠道
  • 淡蓝黑色大气企业网站模板全网营销推广方案
  • 橙色可以做哪些网站武汉网站seo德升
  • 网站建设6135678百度搜索排名靠前
  • 网站后台地址一般是视频号链接怎么获取
  • 高端产品网站品牌运营方案
  • 宠物之家网站建设媒体广告投放平台
  • 东莞寮步二手房seo任务平台
  • 网站制作成本seo优化教程
  • 网站整站出售成都网站建设方案推广
  • 自己做港澳台照片回执网站短视频seo优化
  • 做网站最小的字体是多少像素2023第二波疫情已经到来了吗
  • 设计中国北京不错宁波seo公司
  • 做a图片视频在线观看网站crm客户管理系统
  • 做网站的北京河北关键词排名推广