diff --git a/1216 B. Shooting.cpp b/1216 B. Shooting.cpp index ea02b69..fbf69ac 100644 --- a/1216 B. Shooting.cpp +++ b/1216 B. Shooting.cpp @@ -1,35 +1,38 @@ -//Bismillahir Rahmanir Rahim -#include -#define ll long long -#define ull unsigned long long +#include +#include +#include + using namespace std; + int main() { - int n,a[1001],b[1001],ans = 0; + int n,sum=0; + multimap map; + + //insertion from user i/p cin>>n; - for(int i=0; i>a[i]; - b[i] = a[i]; + int a,i=0,arr[1000],b[1000]; + for(i=1; i<=n; i++) + { + cin >> a; + map.insert(make_pair(a, i)); } - sort(b,b+n,greater()); - for(int i=0; ifirst; + b[i] = itr->second; + i++; + } + int j = 0; + for(i=n-1; i>=0; i--) + { + sum += arr[i]*j + 1; + j++; + } + cout << sum << endl; + for(i=n-1; i>=0; i--) + { + cout << b[i] << " "; } - cout<