/*
   题意:给一个序列,表示每一项任务的难度,要求完成每一项任务的循序是按照难度由小到大的!输出三种符合要求的工作顺序的序列!
   思路:直接看代码....
*/
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. bzoj 2295: 【POJ Challenge】我爱你啊

    2295: [POJ Challenge]我爱你啊 Time Limit: 1 Sec  Memory Limit: 128 MB Description ftiasch是个十分受女生欢迎的同学,所以 ...

  2. 《Windows核心编程》学习笔记(9)– 在win7或者vista系统下提升一个进程的运行权限

    win7或者vista默认运行程序是在受限制的环境下运行的,以减轻病毒对于系统的破坏.那么我们怎样才能提升一个进程的权限以至让它在 管理员模式下运行.当然CreateProcess函数没有提供这个功能 ...

  3. Unity 5.4 测试版本新特性---因吹丝停

    原文:http://blogs.unity3d.com/2016/03/15/enhanced-visuals-better-performance-and-more-the-unity-5-4-pu ...

  4. 【转】使用Cocoapods创建私有podspec

    Cocoapods是非常好用的一个iOS依赖管理工具,使用它可以方便的管理和更新项目中所使用到的第三方库,以及将自己的项目中的公共组件交由它去管理.Cocoapods的介绍及优点本文就不在赘述,我开始 ...

  5. SMON功能(二):合并空闲区间

    SMON的作用还包括合并空闲区间(coalesces free extent) 触发场景 早期Oracle采用DMT字典管理表空间,不同于今时今日的LMT本地管理方式,DMT下通过对FET$和UET$ ...

  6. RPC 135端口

  7. 微信、陌陌等著名IM软件设计架构详解

    对微信.陌陌等进行了分析,发出来分享一下(时间有些久了) 电量:对于移动设备最大的瓶颈就是电量了.因为用户不可能随时携带电源,充电宝.所以必须考虑到电量问题.那就要检查我们工程是不是有后台运行,心跳包 ...

  8. 从《BLAME!》说开去——新一代生产级卡通真实感混合的渲染方案

    <BLAME!>是Polygon Pictures Inc.(以下简称PPI)创业33周年以来制作的第一部CG剧场电影,故事来自于贰瓶勉的同名漫画作品(中文译名为<探索者>或者 ...

  9. “Adobe Flash Player因过期而遭到阻止”的解决办法

    谷歌浏览器总是提示“Adobe Flash Player因过期而遭到阻止”,然后点进去,又更新不了,因为伟大的TC已经把谷歌屏蔽了. 解决办法就是到flash官网更新到最新的Flash https:/ ...

  10. 使用Dezender对zend加密后的php文件进行解密

    在开发中需要修改一些php文件,部分是通过zend加密的,记事本打开之后是这样的: 此时需要使用Dezender进行解密,下载链接如下: Dezender.7z 下载后解压到C盘(路径不要带有中文), ...