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. 如何下载Red Hat Enterprise Linux系统

    关于如何下载Red Hat Enterprise Linux系统? 这是一个既简单,又复杂的问题.简单是因为我以为她很简单,复杂是因为下载的过程有点复杂的. 相信去Oracle官网下载过东西的同学对下 ...

  2. 虚拟机下linux 的root密码忘记怎么修改(转)

    1.开机时任意按一个方向键,进入界面,选择linux系统,按e键进入 2.然后用上下键选择kerner(内核)那一行,按e键进入编辑界面,编辑界面最后一行显示如下:(grub edit> ker ...

  3. PHP学习3——数组

    主要内容: 简介 常用的方法 循环遍历数组 PHP预定义数组 数组的处理函数 数组 PHP由于是弱类型的语言,他的变量类型是可以自由变换的,他的数组很自由,长度是可以动态增加的. 他的索引默认为数字0 ...

  4. Swift函数_inout参数

    //无inout参数的函数 func changeName(var name:String){ name = "Hello" println(name) } let payerNa ...

  5. jquery报表插件收藏 MARK

    Highcharts http://www.hcharts.cn/ 统计报表插件 jquery ui官网 http://jqueryui.com/selectmenu/#custom_render

  6. Java 重写(Override)与重载(Overload)区别

    2019-04-1217:31:19 (1)方法重载是一个类中定义了多个方法名相同,而他们的参数的数量不同或数量相同而类型和次序不同,则称为方法的重载(Overloading). (2)方法重写是在子 ...

  7. thinkphp 手机号和用户名同时登录

    //在注册时用户名不能是纯数字, 防止一个人的用户名和另一个人的手机号相同public function Login(){ if (IS_AJAX) { $username = I('param.us ...

  8. struts2 国际化语言转换

    学习struts2,了解了使用struts2的配置文件可以走向国际化,实现页面的语言转换.我已中文和英文为例,简单的实现登录页面的国际化 废话不多说,上代码 一,login.jsp页面 使用s标签&l ...

  9. mockito測試框架

    1. code package com.springinaction.knights; import static org.mockito.Mockito.*; import org.junit.Te ...

  10. Grunt usemin前端自动化打包流程

    前端优化是尽量减少http请求,所以我们需要尽量合并压缩文件,然后调用压缩后的文件,比如多个css文件压缩成一个,多个js文件合并压缩等,usemin能够自动在html中使用压缩后的文件,达到上面的目 ...