1100 final standings
Posted stiles
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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[150005]; bool temp(node a, node b) { return a.m > b.m; } int main(){ //freopen("input.txt","r",stdin); int N = 0; cin >> N; for(int i = 0; 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 = 0; i<N; i++) cout << a[i].id <<" "<< a[i].m << endl; return 0; }
以上是关于1100 final standings的主要内容,如果未能解决你的问题,请参考以下文章
[AndroidStudio]_[初级]_[配置自动完成的代码片段]