Skip to content

Instantly share code, notes, and snippets.

@modos
Created July 16, 2022 01:16
Show Gist options
  • Save modos/68c1037a47163f3c41af6b89b97731fb to your computer and use it in GitHub Desktop.
Save modos/68c1037a47163f3c41af6b89b97731fb to your computer and use it in GitHub Desktop.
جایگشت ها
#include<bits/stdc++.h>
using namespace std;
const int N = 505;
int a[N];
int main()
{
int n;
cin >> n;
for (int i = 0;i < n;i++)
cin >> a[i];
vector<int>ans;
for (int i = n - 1;i >= 0;i--)
ans.insert(ans.begin() + a[i], i);
cout << ans.front() + 1;
for (int i = 1;i < ans.size();i++)
cout << ',' << ans[i] + 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment