C. A Mist of Florescence
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

题目链接
As the boat drifts down the river, a wood full of blossoms shows up on the riverfront.

"I've been here once," Mino exclaims with delight, "it's breathtakingly amazing."

"What is it like?"

"Look, Kanno, you've got your paintbrush, and I've got my words. Have a try, shall we?"

There are four kinds of flowers in the wood, Amaranths, Begonias, Centaureas and Dianthuses.

The wood can be represented by a rectangular grid of nn rows and mm columns. In each cell of the grid, there is exactly one type of flowers.

According to Mino, the numbers of connected components formed by each kind of flowers are aa, bb, cc and dd respectively. Two cells are considered in the same connected component if and only if a path exists between them that moves between cells sharing common edges and passes only through cells containing the same flowers.

You are to help Kanno depict such a grid of flowers, with nn and mm arbitrarily chosen under the constraints given below. It can be shown that at least one solution exists under the constraints of this problem.

Note that you can choose arbitrary nn and mm under the constraints below, they are not given in the input.

Input

The first and only line of input contains four space-separated integers aa, bb, cc and dd (1≤a,b,c,d≤1001≤a,b,c,d≤100) — the required number of connected components of Amaranths, Begonias, Centaureas and Dianthuses, respectively.

Output

In the first line, output two space-separated integers nn and mm (1≤n,m≤501≤n,m≤50) — the number of rows and the number of columns in the grid respectively.

Then output nn lines each consisting of mm consecutive English letters, representing one row of the grid. Each letter should be among 'A', 'B', 'C' and 'D', representing Amaranths, Begonias, Centaureas and Dianthuses, respectively.

In case there are multiple solutions, print any. You can output each letter in either case (upper or lower).

Examples
input

Copy

5 3 2 1

output

Copy

4 7
DDDDDDD
DABACAD
DBABACD
DDDDDDD

input

Copy

50 50 1 1

output

Copy

4 50
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
ABABABABABABABABABABABABABABABABABABABABABABABABAB
BABABABABABABABABABABABABABABABABABABABABABABABABA
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD

input

Copy

1 6 4 5

output

Copy

7 7
DDDDDDD
DDDBDBD
DDCDCDD
DBDADBD
DDCDCDD
DBDBDDD
DDDDDDD

Note

In the first example, each cell of Amaranths, Begonias and Centaureas forms a connected component, while all the Dianthuses form one.

题解:构造题。

题解链接

Codeforces C. A Mist of Florescence相关推荐

  1. CF思维联系– Codeforces-989C C. A Mist of Florescence

    ACM思维题训练集合 C. A Mist of Florescence time limit per test 1 second memory limit per test 256 megabytes ...

  2. C - A Mist of Florescence CodeForces - 989C

    As the boat drifts down the river, a wood full of blossoms shows up on the riverfront. "I've be ...

  3. Codeforces 989C (构造)

    传送门 题面: C. A Mist of Florescence time limit per test 1 second memory limit per test 256 megabytes in ...

  4. ACM思维题训练 Section A

    题目地址: 选题为入门的Codeforce div2/div1的C题和D题. 题解: A:CF思维联系–CodeForces -214C (拓扑排序+思维+贪心) B:CF–思维练习-- CodeFo ...

  5. CCPC-Wannafly Summer Camp 2019 全记录

    // 7.19-7.29 东北大学秦皇岛校区十天训练营,题目都挂在了Vjudge上.训练期间比较忙,没空更博总结,回来继续补题消化. Day1 这天授课主题是简单图论,节奏挺好,wls两小时理完图论里 ...

  6. CodeForces 375D Tree and Queries

    传送门:https://codeforces.com/problemset/problem/375/D 题意: 给你一颗有根树,树上每个节点都有其对应的颜色,有m次询问,每次问你以点v为父节点的子树内 ...

  7. 「日常训练」Bad Luck Island(Codeforces Round 301 Div.2 D)

    题意与分析(CodeForces 540D) 是一道概率dp题. 不过我没把它当dp做... 我就是凭着概率的直觉写的,还好这题不算难. 这题的重点在于考虑概率:他们喜相逢的概率是多少?考虑超几何分布 ...

  8. 【codeforces 812C】Sagheer and Nubian Market

    [题目链接]:http://codeforces.com/contest/812/problem/C [题意] 给你n个物品; 你可以选购k个物品;则 每个物品有一个基础价值; 然后还有一个附加价值; ...

  9. CodeForces 获得数据

    针对程序的输出可以看见 CodeForces :当输入.输出超过一定字符,会隐藏内容 所以:分若干个程序进行输入数据的获取 1. 1 for (i=1;i<=q;i++) 2 { 3 scanf ...

最新文章

  1. steam你所在的国家不允许看到此内容_Steam德国屏蔽“仅限成人”标签 众多3A大作可能被禁...
  2. 嵌入式ARM Linux开发板自启动,跳过输入root用户名和密码
  3. dc综合与pt静态时序分析(中文)_小三电系统(PDU+DC+OBC)的技术研究
  4. Spark _04集群搭建及测试
  5. 爱奇艺体育:体验Serverless极致扩缩容,资源利用率提升40%
  6. 数据库恢复子系统的常见技术和方案对比(一)
  7. NAT负载均衡_ftp
  8. 对话中国AI先锋,生态科技岛首秀深圳
  9. 机会难得 | 这家上市公司终于招人了
  10. 1个app的完整测试用例_APP测试流程
  11. 标准C语言程序设计第七版pdf,C语言程序设计课程标准.PDF
  12. Centos7使用docke搭建openV
  13. MDI打开文件时指定目录
  14. 「魔兽世界怀旧服」衣米魔兽怀旧服玩家年度实物礼品发放
  15. PDF文件密码怎么解除
  16. wangEditor 粘贴从 word 复制的带图片内容的最佳实践
  17. SDK是什么?与API有什么关系?
  18. Linux命令之pwd
  19. 运行新项目的时候 出现 The type javax.servlet.http.HttpServletRequest cannot be resolved.
  20. 整型与指针的相互转换(int-int*,long-long*)

热门文章

  1. vue组件中prop属性
  2. EDK2编译环境搭建、编译、在模拟器运行、在笔记本运行(带目录版本)
  3. Frps一键安装脚本,带Frpc Windows便捷启动脚本
  4. 【6.28校内test】T2 【音乐会】二重变革
  5. 用友U8案例实验实际成本后台配置
  6. Scala基础语法学习
  7. 天语3com.android.phon,万能遥控(com.duokan.phone.remotecontroller) - 6.0.6 - 应用 - 酷安
  8. Ubuntu-samba服务器的搭建
  9. win10怎么更新显卡驱动_win10更新失败无限重启怎么办
  10. 一个基于OpenDDS的股票报价Stock Quote和交易exchange 的完整用例介绍