Problem 2621 --Permutation - Permutation

2621: Permutation - Permutation

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $298$ 正确数量 $371$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签 STL
For given a sequence A={a0,a1,...,an−1}, print the previous permutation and the next permutation in lexicographic order.

A sequence is given in the following format.

a0 a1...an−1

Print the previous permutation, the given sequence and the next permutation in the 1st, 2nd and 3rd lines respectively. Separate adjacency elements by a space character. Note that if there is no permutation, print nothing in the corresponding line.
3
2 1 3
3
3 2 1
1 3 2
2 1 3
2 3 1
3 1 2
3 2 1
1≤n≤9 ai consist of 1,2,...,n

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

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$0 $ms] 新技能 816992 2022-03-07 07:52:46
内存最少[$1116 $KB] 7oby 469954 2019-09-18 19:57:50
第一AC 计爱玲 281985 2018-10-07 16:57:54
第一挑战 计爱玲 281985 2018-10-07 16:57:54

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

竞赛编号 竞赛名称 竞赛时间 访问比赛
1797 2023-2024-2学期<计算机专业竞赛实训> 第1周练习:STL基础和高精度计算【22计算机】 2024-02-26 00:00:00 请登录
1737 2022-2023-2学期<计算机专业竞赛实训> 第3周练习:STL基础:string/高精度计算【21计算机12345】 2023-03-07 07:00:00 请登录
1681 2021-2022-2学期<算法分析与设计> 第2周练习:STL算法:string/高精度计算 2022-02-28 08:00:00 请登录
1406 安财贸20190918晚上测试 2019-09-18 17:30:00 请登录