Răspuns:
#include <iostream>
using namespace std;
int v[1001], w[1001];
int main()
{
int n, i, t, j;
cin >> n;
for (i=1; i<=n; ++i)
{
cin >> v[i]; w[i]=i;
}
for (i=1; i<n; ++i)
{
for (j=i+1; j<=n; ++j)
{
if (v[j]<v[i]) { t=v[i]; v[i]=v[j]; v[j]=t;
t=w[i]; w[i]=w[j]; w[j]=t; }
}
}
for (i=1; i<=n; ++i) cout << w[i] << " ";
cout << "\n";
return 0;
}
Explicație: