/*
   题意:给一个序列,表示每一项任务的难度,要求完成每一项任务的循序是按照难度由小到大的!输出三种符合要求的工作顺序的序列!
   思路:直接看代码....
*/
1 #include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define N 2005
using namespace std;
struct node{
int h;
int p;
}; node nd[N]; int vis[N]; bool cmp(node a, node b){
return a.h < b.h;
} void swap(int *p, int *q){
int t = *p;
*p = *q;
*q = t;
} int main(){
int n;
scanf("%d", &n);
for(int i=; i<=n; ++i){
scanf("%d", &nd[i].h);
nd[i].p=i;
}
sort(nd+, nd+n+, cmp);
int cnt = ;
for(int i=; i<n; ++i){
for(int j=i+; j<=n; ++j)
if(nd[i].h == nd[j].h)
++cnt;//找到有多少对数相同的
else{ i=j-; break; }
} if(cnt<) cout<<"NO"<<endl;//如果少于两对,一定不能
else{
cout<<"YES"<<endl;
cout<<nd[].p;
for(int i=; i<=n; ++i)//输出源序列
cout<<" "<<nd[i].p;
cout<<endl;
int p;
for(int i=; i<n; ++i)
if( nd[i].h == nd[i+].h){//找到第一对相同的交换位置
p = i;
swap(&nd[i].p, &nd[i+].p);
break;
}
cout<<nd[].p;
for(int i=; i<=n; ++i)
cout<<" "<<nd[i].p;
cout<<endl;
for(int i=; i<n; ++i)//找到第二对相同的交换位置
if( nd[i].h == nd[i+].h && i != p){
swap(&nd[i].p, &nd[i+].p);
break;
} cout<<nd[].p;
for(int i=; i<=n; ++i)
cout<<" "<<nd[i].p;
cout<<endl;
} return ;
}

codeforces MUH and Important Things的更多相关文章

  1. cf471B MUH and Important Things

    B. MUH and Important Things time limit per test 1 second memory limit per test 256 megabytes input s ...

  2. codeforces 471B. MUH and Important Things 解题报告

    题目链接:http://codeforces.com/problemset/problem/471/B 题目意思:有 n 个 tasks,编号依次为 1 - n,每个 task 都有一定的难度值来评估 ...

  3. Codeforces Round #269 (Div. 2) B. MUH and Important Things

    It's time polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from t ...

  4. Codeforces Gym 100338C Important Roads 最短路+Tarjan找桥

    原题链接:http://codeforces.com/gym/100338/attachments/download/2136/20062007-winter-petrozavodsk-camp-an ...

  5. codeforces Gym 100338C Important Roads (重建最短路图)

    正反两次最短路用于判断边是不是最短路上的边,把最短路径上的边取出来建图.然后求割边.注意重边,和卡spfa. 正权,好好的dijkstra不用,用什么spfa? #include<bits/st ...

  6. codeforces MUH and Cube Walls

    题意:给定两个序列a ,b, 如果在a中存在一段连续的序列使得 a[i]-b[0]==k, a[i+1]-b[1]==k.... a[i+n-1]-b[n-1]==k 就说b串在a串中出现过!最后输出 ...

  7. codeforces471B

    MUH and Important Things CodeForces - 471B It's time polar bears Menshykov and Uslada from the zoo o ...

  8. CodeForces 471C MUH and House of Cards

    MUH and House of Cards Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & % ...

  9. Codeforces Gym 100338C C - Important Roads tarjan

    C - Important RoadsTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contes ...

随机推荐

  1. AutoMapper完成Dto与Model的转换

    在实际的软件开发项目中,我们的“业务逻辑”常常需要我们对同样的数据进行各种变换. 例如,一个Web应用通过前端收集用户的输入成为Dto,然后将Dto转换成领域模型并持久化到数据库中.相反,当用户请求数 ...

  2. 内存中 OLTP - 常见的工作负荷模式和迁移注意事项(一)

    ----------------------------我是分割线------------------------------- 本文翻译自微软白皮书<In-Memory OLTP – Comm ...

  3. Language

    TODO Java(jdk8),Scala,Spring,Spark,Python,Linux,C,Netty,HttpClient,Hadoop YARN,RaspberryPi Jetty,Tom ...

  4. Andorid--java0

    java code: public class Hello{     public static void main(String argv[]) {        System.out.printl ...

  5. [转]如果我有jQuery背景,我应该如何切换到AngularJS的思维模式?

    导言 stackoverflow上有一个人问了一个问题:如果我有jQuery背景,我应该如何切换到AngularJS的思维模式? 有一个回复非常经典,获得了两千多票. 为了让国内开发者也能领略到其中的 ...

  6. ubuntu 16.04 有道词典

    依赖环境 sudo apt install \ python3-pyqt5 \ python3-requests \ python3-xlib \ python3-pil \ tesseract-oc ...

  7. 网页内容导出word/excel的js代码

    IE设置: 工具-> Internet选项-> 安全->自定义级别-> 对没有标记安全级别的ActiveX控件进行初始化  设为启用! 1.导出word //指定区域导出到Wo ...

  8. html5media.js 让浏览器兼容<Video><Audio> 标签

    介绍:https://html5media.info/ 项目:https://github.com/etianen/html5media Wiki:https://github.com/etianen ...

  9. javascript 搜索二叉树

    function Tree() { this.root = null; } Tree.prototype = { constructor: Tree, addItem: function(value) ...

  10. HTML Hyperlink between and within pages

    In HTML, we can use tag <a href=""> to create hyperlinks between and within pages. T ...