【CodeForces - 471B】MUH and Important Things (模拟,细节)

题干:

It's time polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev got down to business. In total, there are ntasks for the day and each animal should do each of these tasks. For each task, they have evaluated its difficulty. Also animals decided to do the tasks in order of their difficulty. Unfortunately, some tasks can have the same difficulty, so the order in which one can perform the tasks may vary.

Menshykov, Uslada and Horace ask you to deal with this nuisance and come up with individual plans for each of them. The plan is a sequence describing the order in which an animal should do all the n tasks. Besides, each of them wants to have its own unique plan. Therefore three plans must form three different sequences. You are to find the required plans, or otherwise deliver the sad news to them by stating that it is impossible to come up with three distinct plans for the given tasks.

Input

The first line contains integer n (1 ≤ n ≤ 2000) — the number of tasks. The second line contains n integers h1, h2, ..., hn (1 ≤ hi ≤ 2000), where hi is the difficulty of the i-th task. The larger number hi is, the more difficult the i-th task is.

Output

In the first line print "YES" (without the quotes), if it is possible to come up with three distinct plans of doing the tasks. Otherwise print in the first line "NO" (without the quotes). If three desired plans do exist, print in the second line ndistinct integers that represent the numbers of the tasks in the order they are done according to the first plan. In the third and fourth line print two remaining plans in the same form.

If there are multiple possible answers, you can print any of them.

Examples

Input

4
1 3 3 1

Output

YES
1 4 2 3 
4 1 2 3 
4 1 3 2 

Input

5
2 4 1 4 8

Output

NO

Note

In the first sample the difficulty of the tasks sets one limit: tasks 1 and 4 must be done before tasks 2 and 3. That gives the total of four possible sequences of doing tasks : [1, 4, 2, 3], [4, 1, 2, 3], [1, 4, 3, 2], [4, 1, 3, 2]. You can print any three of them in the answer.

In the second sample there are only two sequences of tasks that meet the conditions — [3, 1, 2, 4, 5] and [3, 1, 4, 2, 5]. Consequently, it is impossible to make three distinct sequences of tasks.

题目大意:

   给定n个任务,每个任务有一个难度值,现在要你输出一个完成任务的三种序列,要求有二:1.如果难度值不同的话先完成难度值低的,难度值相同的任务先完成哪个都行。

解题报告:

   很简单的模拟题啊但是写挂好多次,,难受难受、、、其实这题要想代码短一点,,上来就排序就完事了,然后扫一遍看前后两个值相同的个数是否大于等于两个  如果小于两个输出NO 大于等于两个就取前两个然后乱搞。

AC代码:(冗长的代码不想再读第二遍)

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<set>
#include<string>
#include<cmath>
#include<cstring>
#define ll long long
#define pb push_back
#define pm make_pair
#define fi first
#define se second
using namespace std;
const int MAX = 2e5 + 5;
int bk[MAX];
int a[MAX];
int n;
int c2,c3;
struct Node {int dif,pos;
} node[MAX];
bool cmp(Node a,Node b) {return a.dif<b.dif;
}
int main()
{cin>>n;for(int i = 1; i<=n; i++) scanf("%d",a+i),bk[a[i]]++,node[i].dif=a[i],node[i].pos=i;for(int i = 1; i<=2000; i++) {if(bk[i] >= 3) c3++,c2++;if(bk[i] >= 2) c2++;}if(c3==0 && c2<=1) {puts("NO");return 0 ;}sort(node+1,node+n+1,cmp);puts("YES");if(c3 >= 1) {for(int i = 1; i<=2000; i++) {if(bk[i] >= 3) {c3=i;break;}}for(int i = 1,flag=0; i<=n;) {if(node[i].dif == c3 && flag == 0) {printf("%d %d %d ",node[i].pos,node[i+1].pos,node[i+2].pos);i+=3;flag=1;}else {printf("%d ",node[i].pos);i++;}}puts("");for(int i = 1,flag=0; i<=n;) {if(node[i].dif == c3 && flag == 0) {printf("%d %d %d ",node[i+1].pos,node[i].pos,node[i+2].pos);i+=3;flag=1;}else {printf("%d ",node[i].pos);i++;}}puts("");for(int i = 1,flag=0; i<=n;) {if(node[i].dif == c3 && flag == 0) {printf("%d %d %d ",node[i+2].pos,node[i+1].pos,node[i].pos);i+=3;flag=1;}else {printf("%d ",node[i].pos);i++;}}		}else {int tot=0,c[4]={0};for(int i = 1; i<=2000; i++) {if(bk[i] == 2) c[++tot] = i;if(tot==2) break;}for(int i = 1; i<=n;) {if(node[i].dif == c[1]) {printf("%d %d ",node[i].pos,node[i+1].pos);i+=2;}else {printf("%d ",node[i].pos);i++;}}puts(""); for(int i = 1; i<=n;) {if(node[i].dif == c[2]) {printf("%d %d ",node[i+1].pos,node[i].pos);i+=2;}else {printf("%d ",node[i].pos);i++;}}puts("");for(int i = 1; i<=n;) {if(node[i].dif == c[1]) {printf("%d %d ",node[i+1].pos,node[i].pos);i+=2;}else {printf("%d ",node[i].pos);i++;}}		}return 0 ;}

总结:

   注意那个flag那个地方必须要有啊,不然比如n=10然后给你十个1,,,你就很难受了,,会发现多输出了两个数。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/440933.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

大一计算机绩点3算什么水平,绩点只有3?我可以解释一下

放张图文无关压压惊最近开始申请学业奖学金了&#xff0c;大家开始计算自己的绩点&#xff0c;我也算了一下自己的成绩&#xff0c;结果是比3多一点点(如果没有算错的话)。我觉得这是一个比较合适的数字&#xff0c;没有比3小已经很满足了&#xff0c;毕竟学的并不好&#xff0…

不能用了 重装系统git_怎么用光盘重装系统?

身边没有U盘&#xff0c;电脑无法进入操作系统&#xff0c;只有一个系统光盘如何给电脑重装系统呢&#xff1f;受条件限制不能通过小白在线安装和U盘重装&#xff0c;今天教大家怎么用光盘重装系统吧。光盘重装系统准备工作1、保证电脑带有光驱功能&#xff0c;并且光驱处于正常…

【CodeForces - 472A】Design Tutorial: Learn from Math (tricks,思维,数论,打表)

题干&#xff1a; One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that. For example, there is a statement called the "Goldbachs conject…

浙江经济职业技术学院计算机排名,浙江经济职业技术学院排名第几

关于浙江经济职业技术学院排名的问题考生问&#xff1a; 关于浙江经济职业技术学院的排名&#xff0c;我想抛给小编姐姐几个问题哦。一、浙江经济职业技术学院今年排名第几&#xff1f;对&#xff0c;指的是全国千余所专科院校当中的排名哦&#xff1b;二、浙江经济职业技术学院…

webform计算某几列结果_WebForm获取checkbox选中的值(几个简单的示例)

PS&#xff1a;最近在做权限管理这个模块&#xff0c;发现用checkbox的地方挺多的&#xff0c;于是写了个简单的例子&#xff0c;以供以后学习和使用。1.前端页面&#xff1a;张三李四王五赵六孙琦猪八2.后台方法&#xff1a;#region 获取从前端页面回传过来的 CheckBox 的值 v…

东明县计算机学校,东明县职业中等专业学校2021年招生信息

一、2021年东明县职业中等专业学校招生计划(一) 职教高考提前批招生计划学校代码专业名称招收人数学制学费备注说明863化学工艺40三年免学费从2022年起&#xff0c;山东省开始实施“职教高考”制度&#xff0c;采 取“文化素质职业技能”考试招生办法&#xff0c;职教高考的 本…

python去除图像光照不均匀_低光照环境下图像增强相关

Low-Light Image Enhancement via a Deep Hybrid Network [TIP2019]Underexposed Photo Enhancement using Deep Illumination Estimation[CVPR2019]---------Low-Light Image Enhancement via a Deep Hybrid Network [TIP2019]作者提出一个混合的网络来同时学习内容&#xff0…

【CodeForces - 523C】Name Quest (模拟)

题干&#xff1a; A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or mo…

w10计算机无法打印,老司机解答win10系统电脑无法打印的详细技巧

大家在使用电脑工作的时候会遇到win10系统电脑无法打印的问题&#xff0c;于是就有一些朋友到本站咨询win10系统电脑无法打印问题的解决步骤。解决win10系统电脑无法打印的问题非常简单&#xff0c;只需要你依照1、请确保打印机已打开并连接到你的电脑。 2、如果仍然无法工作&…

vb外部调用autocad_AutoCAD教程之图块的各种相关操作和概念

制图过程中&#xff0c;有时常需要插入某些特殊符号供图形中使用&#xff0c;此时就需要运用到图块及图块属性功能。利用图块与属性功能绘图&#xff0c;可以有效地提高作图效率与绘图质量。也是绘制复杂图形的重要组成部分。一、图块的特点图块是一组图形实体的总称&#xff0…

【CodeForces - 520C】DNA Alignment (快速幂,思维)

题干&#xff1a; Vasya became interested in bioinformatics. Hes going to write an article about similar cyclic DNA sequences, so he invented a new method for determining the similarity of cyclic sequences. Lets assume that strings s and t have the same l…

华北电力大学计算机考研大纲,2015年华北电力大学(保定)085211计算机技术考研大纲...

《529数据库原理及应用》一、考试内容范围&#xff1a;1.绪论1)数据管理技术的发展历史2)数据库管理系统的概念和功能3)数据库系统的特点4)数据库的三级模式结构、两级映像功能和数据独立性5)数据模型的组成要素和典型的数据模型6)概念模型的基本概念和概念模型的常用表示方法(…

echart 动画 饼图_echarts构建关系图,节点可收缩和展开,可添加点击事件

echarts下载及使用ECharts&#xff0c;一个使用 JavaScript 实现的开源可视化库&#xff0c;可以流畅的运行在 PC 和移动设备上&#xff0c;兼容当前绝大部分浏览器&#xff08;IE8/9/10/11&#xff0c;Chrome&#xff0c;Firefox&#xff0c;Safari等&#xff09;&#xff0c;…

【牛客 - 317C】小a与星际探索(背包dp 或 线性基)

题干&#xff1a; 小a正在玩一款星际探索游戏&#xff0c;小a需要驾驶着飞船从11号星球出发前往nn号星球。其中每个星球有一个能量指数pp。星球ii能到达星球jj当且仅当pi>pjpi>pj。 同时小a的飞船还有一个耐久度tt&#xff0c;初始时为11号点的能量指数&#xff0c;若小…

计算机及数控编程仿真软件exsl-win7,数控编程实验.doc

文档介绍&#xff1a;现代制造技术综合实验中心数控铣编程与仿真实验指导书1.实验目的:(1)通过上机实验巩固课堂所讲述的数控铣指令,掌握数控铣手工编程方法。(2)掌握EXSL-WIN7软件的编程及仿真等主要功能。2.实验设备或软件:计算机及数控编程仿真软件EXSL-WIN7。3.实验原理:根…

三菱socket通信实例_三菱自动化产品相关知识整理汇总

先从应用最广泛的PLC产品来说下&#xff1a;小型机&#xff1a;FX3S、FX3G、FX3U、FX5U 中型机&#xff1a;L系列大型机&#xff1a;Q系列、R系列Q是比较老的产品&#xff0c;也是现在大型机里面应用比较普遍的产品&#xff0c;在Q之后开发出性价比比较高的产品L系列和性能更高…

【牛客 - 317B】小a与204(贪心,构造,水题)

题干&#xff1a; 小a非常喜欢204204这个数字&#xff0c;因为′a′′k′204′a′′k′204。 现在他有一个长度为nn的序列&#xff0c;其中只含有2,0,42,0,4这三种数字 设aiai为序列中第ii个数&#xff0c;你需要重新排列这个数列&#xff0c;使得∑ni1(ai−ai−1)2∑i1n(ai−…

英语人机考试计算机算分吗,英语人机对话考试技巧

1英语 人机对话考试技巧目前要在英语口语人机对话中获得好的成绩&#xff0c;除了了解测试的特点之外&#xff0c;还需掌握一定的技巧、这对提高英语口语人机对话成绩将起到事半功倍的作用。接下来小编告诉你英语人机对话考试技巧。调整心态&#xff0c;临场莫慌听力不同于其他…

玛纽尔扫地机器人怎样_扫地机器人哪个牌子好?满足日常清洁需求才值得推荐...

随着科技的发展,越来越多的家庭入手扫地机器人来代替日常打扫,而扫地机器人以其高智能化、自动化和便捷的清洁方式也获得了大部分家庭的喜爱。从市面上出售的扫地机器人来看,就清洁方面足以满足大部分家庭的需求,但是更进一步的定位巡航技术、扫拖一体功能以及强劲的续航保证,却…

【牛客 - 317D】小a与黄金街道(数论,tricks)

题干&#xff1a; 链接&#xff1a;https://ac.nowcoder.com/acm/contest/317/D 来源&#xff1a;牛客网 小a和小b来到了一条布满了黄金的街道上。它们想要带几块黄金回去&#xff0c;然而这里的城管担心他们拿走的太多&#xff0c;于是要求小a和小b通过做一个游戏来决定最…