Cod sursa(job #1075555)

Utilizator cristi23ciulica cristian cristi23 Data 9 ianuarie 2014 10:20:24
Problema Heavy metal Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.43 kb
#include <fstream>
#include<string.h>
using namespace std;
ifstream f("heavymetal.in");
ofstream g("heavymetal.out");
int i,n;
struct metal{
int a,b;
}v[8001],x;
int cmp(metal x,metal y){
    if (x.a<y.a)
        return 1;
    if (x.a==y.a&&x.b<y.b)
        return 1;
    else
        return 0;
        }
int main(){
    f>>n;
    for (i=1;i<=n;i++)
        f>>v[i].a>>v[i].b;
    sort(v+1,v+n+1,cmp);

return 0;
}