http://acm.timus.ru/problem.aspx?space=1&num=1100 link to the problem

make a fast stable sorting algorithm.

what is sort in c, quick sort.

what is a stable sort?

a sorting algorithm is said to be stable if two objects with equal keys appear in the same order in sorted output as they appear in the input array to be sorted.

#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std; struct node
{
int id;
int m;
}a[]; bool temp(node a, node b)
{
return a.m > b.m;
} int main(){
//freopen("input.txt","r",stdin);
int N = ;
cin >> N;
for(int i = ; i<N; i++)
cin >>a[i].id >> a[i].m;
stable_sort(a, a+N, temp);//using stable sort here instead od quick sort
for(int i = ; i<N; i++)
cout << a[i].id <<" "<< a[i].m << endl;
return ;
}

1100 final standings的更多相关文章

  1. ural 1100. Final Standings(数据结构)

    1100. Final Standings Time limit: 1.0 secondMemory limit: 16 MB Old contest software uses bubble sor ...

  2. 1.13抽象类及接口(附简述final关键字)

    一.final final的中文意思就是不可更改的,最终的. 1.final修饰变量,那么该变量无法更改.一旦该变量赋了初值,就不能重新赋值. final MAX = 1100; //final修饰后 ...

  3. 2010-2011 ACM-ICPC, NEERC, Moscow Subregional Contest Problem C. Contest 水题

    Problem C. Contest 题目连接: http://codeforces.com/gym/100714 Description The second round of the annual ...

  4. Codeforces Round #604 (Div. 2) C. Beautiful Regional Contest

    链接: https://codeforces.com/contest/1265/problem/C 题意: So the Beautiful Regional Contest (BeRC) has c ...

  5. [C++]Yellow Cards - GYM - 102348A(Practice *) - CodeForces

    1 Problem Description Problem The final match of the Berland Football Cup has been held recently. Th ...

  6. 继承extends、super、this、方法重写overiding、final、代码块_DAY08

    1:Math类的随机数(掌握) 类名调用静态方法.  包:java.lang 类:Math 方法:public static double random(): Java.lang包下的类是不用导包就可 ...

  7. HDU 6651 Final Exam (思维)

    2019 杭电多校 7 1006 题目链接:HDU 6651 比赛链接:2019 Multi-University Training Contest 7 Problem Description Fin ...

  8. java抽象、接口 和final

    抽象 一.抽象类:不知道是具体什么东西的类. abstract class 类名 1.抽象类不能直接new出来. 2.抽象类可以没有抽象方法. public abstract class USB { ...

  9. Java内部类final语义实现

    本文描述在java内部类中,经常会引用外部类的变量信息.但是这些变量信息是如何传递给内部类的,在表面上并没有相应的线索.本文从字节码层描述在内部类中是如何实现这些语义的. 本地临时变量 基本类型 fi ...

随机推荐

  1. java中的各种命令参数

    java中有很多命令参数,这些命令参数有些是控制jvm行为的,有的则是供应用程序使用.我所了解的参数主要有三种,现在说一说这三种类型的参数. (1)命令行参数. 命令行参数就是类似与c语言的命令行参数 ...

  2. js事件绑定简单写法

    $E.on = function (o, e, f) { return o.addEventListener ? o.addEventListener(e, f, false) : o.attachE ...

  3. Firebird 列可空非空修改

    2018-12-04 至少到Firebird 3.0.4 已经添加了设置可空 和 非空的语法:如 -- 删除非空(设置为可空) ALTER TABLE TECH ALTER label drop NO ...

  4. 分布式事务-Sharding 数据库分库分表

      Sharding (转)大型互联网站解决海量数据的常见策略 - - ITeye技术网站 阿里巴巴Cobar架构设计与实践 - 机械机电 - 道客巴巴 阿里分布式数据库服务原理与实践:沈询_文档下载 ...

  5. html中块元素的居中。及兼容性

    块在块中垂直居中(父元素postion:relative;   子元素position:absolute; top:50%; margin-top:负二分之一高度) 块在块中水平居中 (子元素marg ...

  6. Spring学习笔记:Spring整合Mybatis(mybatis-spring.jar)(二:mybatis整合spring)

    http://blog.csdn.net/qq598535550/article/details/51703190 二.Spring整合mybatis其实是在mybatis的基础上实现Spring框架 ...

  7. JQuery的一些基础知识

    JQuery的核心的一些方法 each(callback) '就像循环$("Element").length; ‘元素的个数,是个属性$("Element"). ...

  8. Eclipse使用快捷键总结

    1.为方法添加注释:Alt + Shift + J

  9. docker 开机自动启动容器

    注意:如果有存在多个容器,都占用了同一端口,那么只会起来一个,要注意,我在调试时候就遇到这个坑了 在使用docker run启动容器时,使用--restart参数来设置: docker run -m  ...

  10. c#之静态构造函数和单例模式

    1.静态构造函数:在创建第一个实例或引用任何静态成员之前,将自动调用静态构造函数来初始化类 public class A { ; : private static A instance_; publi ...