/*
   题意:给一个序列,表示每一项任务的难度,要求完成每一项任务的循序是按照难度由小到大的!输出三种符合要求的工作顺序的序列!
   思路:直接看代码....
*/
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. 进度的Block在子线程调用

    [_pictureView sd_setImageWithURL:[NSURL URLWithString:item.image2] placeholderImage:nil options:SDWe ...

  2. JQ中 trigger()和triggerHandler()区别

    既然使用了trigger和triggerHandler,那么你应该了解了他们的差别了. trigger():在每一个匹配的元素上触发某类事件. triggerHandler():这个特别的方法将会触发 ...

  3. GCD的同步异步串行并行、NSOperation和NSOperationQueue一级用dispatch_once实现单例

    转:http://www.tuicool.com/articles/NVVnMn (1)GCD实现的同步异步.串行并行. ——同步sync应用场景:用户登录,利用阻塞 ——串行异步应用场景:下载等耗时 ...

  4. iOS:如何通过UIEdgeInsetsMake来制作可伸缩的Button

    注:本文翻译自国外iOS开发者Natasha The Robot的一篇博文,链接在此.在iOS应用中,经常会有很多Button有相同的背景图片,却由于处在不同的位置而大小不同(尽管在iOS7中Butt ...

  5. android 平台搭建

    直接到官网下载 http://developer.android.com/sdk/index.html?utm_source=weibolife

  6. Android GPS 临近触发

    前面介绍过LocationManager有一个addProximityAlert(double latitude,double longitude,float radius,long expirati ...

  7. VB中WinSock控件的属性、方法、事件及应用

    一.WinSock简介       Socket(套接字)最初是由加利福尼亚大学Berkeley(伯克利)分校为UNIX操作系统开发的网络通信接口,随着UNIX的广泛使用,Socket成为当前最流行的 ...

  8. 高吞吐量的分布式发布订阅消息系统Kafka--spring-integration-kafka的应用

    一.概述 Spring Integration Kafka 是基于 Apache Kafka 和Spring Integration来集成Kafka,对开发配置提供了方便. 二.配置 1.spring ...

  9. 在Linux下用源码编译安装apache2

    Linux下安装一个软件,最好去看下它的官方guide,apache2.4的安装安装guide 0. installation guide http://httpd.apache.org/docs/2 ...

  10. 在 Excel 中使用正则表达式进行查找与替换

    在 Excel 中,使用 Alt+F11 快捷键打开 VBA 项目窗口,在左侧的工作表名称上点右键,选择查看代码,即可出出现右侧的代码编辑窗口 在代码窗口中输入以下代码: Private Sub Re ...