1100 final standings
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的更多相关文章
- ural 1100. Final Standings(数据结构)
1100. Final Standings Time limit: 1.0 secondMemory limit: 16 MB Old contest software uses bubble sor ...
- 1.13抽象类及接口(附简述final关键字)
一.final final的中文意思就是不可更改的,最终的. 1.final修饰变量,那么该变量无法更改.一旦该变量赋了初值,就不能重新赋值. final MAX = 1100; //final修饰后 ...
- 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 ...
- Codeforces Round #604 (Div. 2) C. Beautiful Regional Contest
链接: https://codeforces.com/contest/1265/problem/C 题意: So the Beautiful Regional Contest (BeRC) has c ...
- [C++]Yellow Cards - GYM - 102348A(Practice *) - CodeForces
1 Problem Description Problem The final match of the Berland Football Cup has been held recently. Th ...
- 继承extends、super、this、方法重写overiding、final、代码块_DAY08
1:Math类的随机数(掌握) 类名调用静态方法. 包:java.lang 类:Math 方法:public static double random(): Java.lang包下的类是不用导包就可 ...
- HDU 6651 Final Exam (思维)
2019 杭电多校 7 1006 题目链接:HDU 6651 比赛链接:2019 Multi-University Training Contest 7 Problem Description Fin ...
- java抽象、接口 和final
抽象 一.抽象类:不知道是具体什么东西的类. abstract class 类名 1.抽象类不能直接new出来. 2.抽象类可以没有抽象方法. public abstract class USB { ...
- Java内部类final语义实现
本文描述在java内部类中,经常会引用外部类的变量信息.但是这些变量信息是如何传递给内部类的,在表面上并没有相应的线索.本文从字节码层描述在内部类中是如何实现这些语义的. 本地临时变量 基本类型 fi ...
随机推荐
- Android使用7牛云存储
第一次使用这个云存储,话说7牛云存储大有来头!区别于国内外其他云存储,七牛自行研发的全分布式架构解决了其他云存储单一数据中心架构可能存在的风险,同时首创双向加速特性对数据上传下载均加速,使得数据访问速 ...
- c#各个版本的特性
现在unity2018.2已经支持c#7.2了 版本特性: https://www.cnblogs.com/zq20/p/6323205.html
- 8、在Shell脚本中使用函数
学习目标Shell的函数 Shell程序也支持函数.函数能完成一特定的功能,可以重复调用这个函数.函数格式如下: 函数名() { 函数体 } 函数调用方式: 函数名 参数列表 实例:编 ...
- Java入门系列-12-成员方法
类的方法 无参方法 语法: public 返回值类型 方法名(参数列表){ //方法的主体 } 敲一敲:无返回值方法 public void sayHi(){ System.out.println(& ...
- [转]angularjs之ui-grid 使用详解
本文转自:http://blog.csdn.net/qhkabuqiluo/article/details/52237710 最近一段时间在使用angularjs 然后就找到ui-grid 这个比较不 ...
- Java实现在线预览–openOffice实现
实现逻辑有两种: 一.利用jodconverter(基于OpenOffice服务)将文件(.doc..docx..xls..ppt)转化为html格式. 二.利用jodconverter(基于Open ...
- JBPM学习第4篇:10分钟熟悉Eclipse
http://download.jboss.org/jbpm/videos/7.0.0.Final_eclipse_getting_started.swf 打开视频练习 1.导入 evaluation ...
- laravel后台注册登入
1.只需要在新安装的 Laravel 应用下运行 php artisan make:auth 和 php artisan migrate,这两个命令会生成用户登录注册所需要的所有东西 2.你会发现 h ...
- layui-学习03-页面元素
布局: 相关样式: 包裹层 : layui-container ( 响应式 宽度 ) layui-fluid ( 100% 宽度 )行 : layui-row列 : lay ...
- HTML5拨号 调用手机拨号功能
<a href="tel:123456789">拨号</a> 这个就是HTML5 运行在手机浏览器上的可以调用手机的拨号tel就是你想要拨打的电话号码