Created
March 7, 2015 14:08
-
-
Save ik11235/3f5454c1e3696f373376 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
int main(int argc, char *argv[]) | |
{ | |
int n; | |
cin>>n; | |
vector<int> t; | |
for(int i=0;i<n;i++) | |
{ | |
int tmp; | |
cin>>tmp; | |
t.push_back(tmp); | |
} | |
sort(t.begin(),t.end()); | |
long long int sum=0; | |
long long int time=0; | |
long long int pat=1; | |
int cnt=0; | |
for(int i=0;i<n;i++) | |
{ | |
time+=t[i]; | |
sum+=time; | |
if(i>0&&t[i]==t[i-1]) | |
cnt++; | |
else | |
cnt=1; | |
pat*=cnt; | |
pat%=1000000007; | |
} | |
cout<<sum<<endl; | |
cout<<pat<<endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment