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

    以下是我整理的React学习资料,包括:React基础.Redux.reat-router, redux middleware, higher order components, React验证等, ...

  2. 几种filter的比较

    需要整理 Gaussian filter https://en.wikipedia.org/wiki/Gaussian_filter Laplacian/Laplacian of Gaussian h ...

  3. 2016年 最火的 15 款 HTML5 游戏引擎

    HTML5游戏从2014年Egret引擎开发的神经猫引爆朋友圈之后,就开始一发不可收拾,今年<传奇世界>更是突破流水2000万!从两年多的发展来看,游戏开发变得越来越复杂,需要制作各种炫丽 ...

  4. 【Android开发坑系列】之经常被忽略的背景图片内存泄露

    我们平时设置图片的时候,几乎都忘记回收老的(背景)图片,比如: TextView.setBackgroundDrawable() TextView.setBackgroundResource() Im ...

  5. asp.net发布到IIS中出现错误:处理程序“PageHandlerFactory-Integrated”在其模块列表中有一个错误模块“ManagedPipelineHandler”

    asp.net发布到IIS中出现错误:处理程序“PageHandlerFactory-Integrated”在其模块列表中有一个错误模块“ManagedPipelineHandler” http:// ...

  6. MyEclipse中拷贝J2EE项目,发布到tomcat中名字一样的解决办法

    修改Eclipse工作空间下新拷贝项目下.settings文件夹中org.eclipse.wst.common.component的两个属性值. 为新项目名字: <?xml version=&q ...

  7. iOS 语言切换、本地化,国际化

    什么是本地化处理? 本地化处理就是我们的应用程序有可能发布到世界的很多国家去,因为每个国家应用的语言是不一样的,所以我们要把我们的应用程序的语言要进行本地化处理一下. 本地化处理需要处理那些文件? ( ...

  8. Eclipse中集成Tomcat

    问题: 很多时候在Eclipse中启动Tmocat后,不能访问本机的localhost:8080主页,并且其他项目也不能访问. 原因: 打开Tomcat下的webapp后也找补到项目目录,这是因为Ec ...

  9. LoadRunner 12试用

    LoadRunner 12试用 http://blog.csdn.net/testing_is_believing/article/details/23611845

  10. HTML5新特性之跨文档消息传输

    1.同域限制 所谓“同域限制”是指,出于安全考虑,浏览器只允许脚本与同样协议.同样域名.同样端口的地址进行通信. 2.window.postMessage方法 浏览器限制不同窗口(包括iFrame窗口 ...