這題是結論題

好玄學,不懂

代碼:

#include<bits/stdc++.h>
using namespace std;
struct no{
	int v,p;
	bool operator <(const no &rhs)const{
		return v<rhs.v||v==rhs.v&&p<rhs.p;
	}
}c[100010];
int n,a[100010];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		c[i].v=a[i];
		c[i].p=i;
	}
	sort(c+1,c+n+1);
	int x=c[1].p;
	for(int i=1;i<=n;i++){
		printf("%d ",a[x]);
		x=c[x].p;
	}
}

jzoj100031的更多相关文章

随机推荐

  1. 超星网站cc++

    a系统 苏龙杰     a系统 苏龙杰     目录 1 C/C ++程序设计 1.1 前 言 1.2 第一部分 基 础 篇 1.2.1 第1章 初识C 1.2.1.1 1.1 C语言的诞生与发展 1 ...

  2. Linux Doxygen的安装和使用

    一.简介 Doxygen是一种开源跨平台的,以类似JavaDoc风格描述的文档系统,完全支持C.C++.Java.Objective-C和IDL语言,部分支持PHP.C#.注释的语法与Qt-Doc.K ...

  3. mysql contact_ws函数 字符串被截断问题

    contact函数默认有字符串长度限制,解决方法:SET group_concat_max_len = 20000这个参数设置一下就好了

  4. 765A Neverending competitions

    A. Neverending competitions time limit per test 2 seconds memory limit per test 512 megabytes input ...

  5. dump()

    输出格式化的对象

  6. QTextCodec 类

    https://blog.csdn.net/qq_23948025/article/details/45500637

  7. HBase Filter程序样例及Shell(图)

    ==过滤器执行流程== reset() : reset the filter state before filtering a new row. filterAllRemaining(): true ...

  8. /etc/inittab加入自动启动格式

    R01:35:respawn:/usr/bin/exe_program 说明 R01:标识,每一行必须唯一(R01并无特殊含义,可自定义). 35:有效模式,3字符界面启动,5图形界面启动 respa ...

  9. jQuery Datepicker 插件遇到问题

    Datepicker ver 1.7.3  浏览更多 常用设置 //禁用今天之前时间 $(".datePicker").datepicker('option', { minDate ...

  10. 一次性选中word中全部Table

    Sub 批量修改表格() Dim tempTable As Table Application.ScreenUpdating = False If ActiveDocument.ProtectionT ...