Cod sursa(job #49863)

Utilizator flo_demonBunau Florin flo_demon Data 6 aprilie 2007 15:07:59
Problema Schi Scor 5
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.61 kb
#include <stdio.h>
#include <map>

#define MAXX 60000

using namespace std;

int n, aux;
map<int, int> s;
map<int, int>::iterator start, end;


int main()
{
    FILE *fin = fopen("schi.in", "r");
    fscanf(fin, "%d", &n);
    for (int i = 1; i <= n; ++i)
    {
        fscanf(fin, "%d", &aux);
        aux *= MAXX;
        aux -= i;
        s[aux] = i;
    }
    fclose(fin);
    
    start = s.begin();
    end = s.end();
    
    FILE *fout = fopen("schi.out", "w");
    for (; start != end; ++start)
        fprintf(fout, "%d\n", (*start).second);
    fclose(fout);
    
    return 0;
}