Skip to content

Instantly share code, notes, and snippets.

@yogurt1
Created September 29, 2016 19:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yogurt1/35a305418a6c3f4125888b0e352709b8 to your computer and use it in GitHub Desktop.
Save yogurt1/35a305418a6c3f4125888b0e352709b8 to your computer and use it in GitHub Desktop.
Sort from god
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
int main(void) {
std::ios::sync_with_stdio(false);
int len;
std::cin >> len;
std::vector<int> vec(201);
/* Read array */
int t;
for (int i = 0; i < len; i++) {
std::cin >> t;
vec[t+100]++;
}
for (int i = 0; i < vec.size(); i++) {
for (int j = 0; j < vec[i]; j++) {
std::cout << i - 100 << ' ';
}
}
std::cout << "\n";
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment