Cod sursa(job #2008302)
| Utilizator | Data | 6 august 2017 02:54:42 | |
|---|---|---|---|
| Problema | Sortare prin comparare | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.49 kb |
#include<cstdio>
#include<sys/mman.h>
#include<fcntl.h>
#include<algorithm>
struct ano{
char*s;
ano():s((char*)mmap(0,1<<24,1,2,open("algsort.in", O_RDONLY), 0)){}
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]);
}