Loading web-font TeX/Main/Regular
祝同学们学习进步,编程快乐!
Problem 2645 --Bitset II - Enumeration of Subsets III

2645: Bitset II - Enumeration of Subsets III

"
Time Limit 1 秒/Second(s) Memory Limit 512 兆字节/Megabyte(s)
提交总数 1 正确数量 1
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签 STL

Enumeration of Subsets III

You are given a set TT, which is a subset of SS. The set SS consists of 0,1,...n10,1,...n−1. Print all subsets of TT. Note that we represent 0,1,...n10,1,...n−1 as 00...0001, 00...0010, 00...0100, ..., 10...0000 in binary respectively and the integer representation of a subset is calculated by bitwise OR of existing elements.


Input

The input is given in the following format.

nn kb0b1...bk1kb0b1...bk−1 

kk is the number of elements in TT, and bibi represents elements in TT.


Output

Print the subsets ordered by their decimal integers. Print a subset in the following format.

dd: e0e0 e1e1 ...

Print ':' after the integer value dd, then print elements eiei in the subset in ascending order. Separate two adjacency elements by a space character.


4
2 0 2
0:
1: 0
4: 2
5: 0 2

Constraints

  • 1n281≤n≤28
  • 0k180≤k≤18
  • knk≤n
  • 0bi<n0≤bi<n


推荐代码 查看2645 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[171 ms] AOJ大管家 1163810 2025-01-14 12:31:57
内存最少[2184 KB] AOJ大管家 1163810 2025-01-14 12:31:57
第一AC AOJ大管家 1163810 2025-01-14 12:31:57
第一挑战 AOJ大管家 437043 2019-06-07 13:17:55

赛题来源/所属竞赛 会津大学《C++ Programming II》 C++程序设计(高级)

竞赛编号 竞赛名称 竞赛时间 访问比赛
AOJ
祝同学们学习进步,编程快乐!