-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFullCountingSort.cpp
More file actions
50 lines (40 loc) · 817 Bytes
/
FullCountingSort.cpp
File metadata and controls
50 lines (40 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// problem: "https://www.hackerrank.com/challenges/countingsort4/problem"
#include <bits/stdc++.h>
#include<string>
//ios_base::sync_with_stdio(false);
//sin.tie(NULL);
//ios::sync_with_stdio(false);
using namespace std;
int main()
{
int c;
long int n,i,j;
string a[100],str;
//scanf(" %ld",&n);
cin>>n;
for(i=0;i<n;i++)
{
//scanf(" %d",&c);
cin>>c;
cin>>str;
if(i<n/2)
{
//scanf(" %s",str);
a[c]=a[c]+"- ";
//strcat(a[c],"- ");
}
else
{
//scanf(" %s",str);
//rcat(a[c],str);
a[c]=a[c]+str+" ";
//strcat(a[c]," ");
}
}
for(i=0;i<100;i++)
{
//printf("%s",a[i]);
cout<<a[i];
}
return 0;
}