You are viewing a single comment's thread. Return to all comments →
Hey, this is a cpp solution. Passes all the test cases.
int main() { int n; cin >> n; vector<int> arr(n), hash(100); vector<string> s(n); string out = ""; for ( int i = 0 ; i < n ; i++ ) { cin >> arr[i] >> s[i] ; for ( int j = arr[i] ; j < 100 ; j++ ) { hash[j]++; } } for ( int i = 0 ; i < 100 ; i++ ) { if ( hash[i] > 0 ) { for ( int j = 0 ; j < n ; j++ ) { if ( arr[j] == i){ if ( j < n/2 ) { out += "- "; } else { out += s[j] + " "; } } } } } cout << out; 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 →
Hey, this is a cpp solution. Passes all the test cases.