You are viewing a single comment's thread. Return to all comments →
I did a simple, efficent and yet understandable solution in C++. I hope it's useful for you guys
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> using namespace std; int main() { long int n; cin >> n; string ar[n]; for(long int i = 0; i < n/2; i++){ int x; cin >> x; string s; cin >> s; ar[x] = ar[x] + "-" + " "; } for(long int i = n/2; i < n; i++){ int x; cin >> x; string s; cin >> s; ar[x] = ar[x] + s + " "; } for(int i = 0; i < n; i++) cout << ar[i]; return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
The Full Counting Sort
You are viewing a single comment's thread. Return to all comments →
I did a simple, efficent and yet understandable solution in C++. I hope it's useful for you guys