Skip to content

Instantly share code, notes, and snippets.

@yogurt1 yogurt1/sort.cpp
Created Sep 29, 2016

Embed
What would you like to do?
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
You can’t perform that action at this time.