Cod sursa(job #2008305)

Utilizator Ionut.popescuLiviu Rebreanu Ionut.popescu Data 6 august 2017 02:58:42
Problema Sortare prin comparare Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.5 kb
#include<cstdio>
#include<algorithm>

struct ano{
	char*s;
	ano(): s(new char[1<<24]){
		FILE* f = fopen("algsort.in", "r");
		fread_unlocked(s, 1, 1<<24, f);
		fclose(f);
	}
	operator int(){
		int x=0;
		while(*s<48)++s;
		while(*s>32)
			x=x*10+*s++-48;
		return x;
	}
}buf;

const int N = 500000;

int a[N];

int main(){
	freopen("algsort.out", "w", stdout);
	int n = buf;
	for (int i=0; i<n; ++i) a[i] = buf;
	std::sort(a, a+n);
	for (int i=0; i<n; ++i) printf("%d ", a[i]);
}