#include <iostream> #include <cassert> #include <algorithm> #include <vector> using namespace std; int dp[82][1400005]; pair<int,int> from[82][1400005]; int stare[205][205][205]; int lgmax=80; //int from8205][205][205]; struct ura { int first,second; string rez; }; ura v[205]; int cmp(ura a,ura b) { return a.first>b.first; } int cmp2(pair<string,int> a,pair<string,int> b) { return a.second<b.second; } int cmp3(ura a,ura b) { return a.second<b.second; } int leafuri[105]; vector<pair<string,int> >vec[105]; signed main() { long long n,i,j,z; freopen("a.in","r",stdin); cin>>n; for(i=1; i<=n; i++) { long double x; cin>>x; v[i].first=x*10000; v[i].second=i; } sort(v+1,v+n+1,cmp); int stari=0; for(i=0; i<=n; i++) { for(j=0; i+j<=n; j++) { for(z=0; i+j+z<=n; z++) { stari++; stare[i][j][z]=stari; for(int dept=0; dept<=lgmax; dept++) { dp[dept][stari]=10000000; } } } } dp[0][stare[0][1][0]]=0; for(int nivel=0; nivel<=lgmax; nivel++) { for(i=0; i<=n; i++) { for(j=0; i+j<=n; j++) { for(z=0; i+j+z<=n; z++) { if(j>=1) { if(dp[nivel][stare[i+1][j-1][z]]>dp[nivel][stare[i][j][z]]+v[i+1].first*nivel) { from[nivel][stare[i+1][j-1][z]]={nivel,stare[i][j][z]}; dp[nivel][stare[i+1][j-1][z]]=dp[nivel][stare[i][j][z]]+v[i+1].first*nivel; } } int a=j+z; int b=j; if(a+b+i<=n) { if(dp[nivel+1][stare[i][j+z][j]]>dp[nivel][stare[i][j][z]]) { from[nivel+1][stare[i][j+z][j]]={nivel,stare[i][j][z]}; dp[nivel+1][stare[i][j+z][j]]=dp[nivel][stare[i][j][z]]; } } } } } } //cout<<dp[lgmax][stare[n][0][0]]; //cout<<best; vector<pair<string,int> >strings; pair<int,int>state={lgmax,stare[n][0][0]}; while(state.first!=0) { pair<int,int>a=from[state.first][state.second]; if(a.first==state.first) { leafuri[a.first]++; } state=a; } vec[0].push_back({"",0}); for(i=0;i<=lgmax;i++) { for(j=1;j<=leafuri[i];j++) { strings.push_back(vec[i].back()); vec[i].pop_back(); } while(vec[i].size()) { vec[i+1].push_back({vec[i].back().first+'.',vec[i].back().second+1}); vec[i+2].push_back({vec[i].back().first+'-',vec[i].back().second+2}); vec[i].pop_back(); } } sort(strings.begin(),strings.end(),cmp2); for(i=1;i<=n;i++) { v[i].rez=strings[i-1].first; } sort(v+1,v+n+1,cmp3); for(i=1;i<=n;i++) { cout<<v[i].rez<<'\n'; } return 0; }