fork(5) download
  1. #include <iostream>
  2. #include <cstdio>
  3. using namespace std;
  4.  
  5. int main() {
  6. // your code goes here
  7. int a, arr[1000001]={0}, b;
  8. scanf("%d", &a);
  9. while(a--) {
  10. scanf("%d", &b);
  11. arr[b]++;
  12. }
  13. for(int i=0; i<1000001; i++) {
  14. while(arr[i]>0) {
  15. printf("%d\n", i);
  16. arr[i]--;
  17. }
  18. }
  19. return 0;
  20. }
Success #stdin #stdout 0s 7132KB
stdin
5
5
3
6
7
1
stdout
1
3
5
6
7