/*
Copyright 2011 Marek "p2004a" Rusinowski
Insertion sort
*/
#include <cstdio>
#define MAXN 1000000
int array[ MAXN] ;
int main( ) {
int n;
scanf ( "%d" , & n) ;
for ( int i = 0 ; i < n; ++ i) {
scanf ( "%d" , & array[ i] ) ;
}
for ( int i = 1 ; i < n; ++ i) {
for ( int j = i; j > 0 && array[ j] < array[ j - 1 ] ; -- j) {
int tmp = array[ j] ;
array[ j] = array[ j - 1 ] ;
array[ j - 1 ] = tmp;
}
}
for ( int i = 0 ; i < n; ++ i) {
printf ( "%d " , array[ i] ) ;
}
printf ( "\n " ) ;
return 0 ;
}
LyoKICBDb3B5cmlnaHQgMjAxMSBNYXJlayAicDIwMDRhIiBSdXNpbm93c2tpCiAgSW5zZXJ0aW9uIHNvcnQKKi8KI2luY2x1ZGUgPGNzdGRpbz4KCiNkZWZpbmUgTUFYTiAxMDAwMDAwCgppbnQgYXJyYXlbTUFYTl07CgppbnQgbWFpbigpIHsKICBpbnQgbjsKICBzY2FuZigiJWQiLCAmbik7CiAgZm9yIChpbnQgaSA9IDA7IGkgPCBuOyArK2kpIHsKICAgIHNjYW5mKCIlZCIsICZhcnJheVtpXSk7CiAgfQogIGZvciAoaW50IGkgPSAxOyBpIDwgbjsgKytpKSB7CiAgICBmb3IgKGludCBqID0gaTsgaiA+IDAgJiYgYXJyYXlbal0gPCBhcnJheVtqIC0gMV07IC0taikgewogICAgICBpbnQgdG1wID0gYXJyYXlbal07CiAgICAgIGFycmF5W2pdID0gYXJyYXlbaiAtIDFdOwogICAgICBhcnJheVtqIC0gMV0gPSB0bXA7CiAgICB9CiAgfQogIGZvciAoaW50IGkgPSAwOyBpIDwgbjsgKytpKSB7CiAgICBwcmludGYoIiVkICIsIGFycmF5W2ldKTsKICB9CiAgcHJpbnRmKCJcbiIpOwogIHJldHVybiAwOwp9Cg==
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:13: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result
prog.cpp:15: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result
stdout