# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
9780 | dominyellow | Uniting (kriii2_U) | C++98 | 0 ms | 1236 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
#include <map>
#include <queue>
#include <set>
#include <vector>
using namespace std;
long modu = 1000000007;
long get_multi(vector<long> vec){
long res = vec[0]%modu;
for(int i=1; i<vec.size(); i++){
res = (res*(vec[i]%modu))%modu;
}
return res;
}
long get_permu(long a){
if(a == 2){
return 2;
}
return (a%modu * (a-1)%modu)%modu + get_permu(a-1);
}
int main(void){
long dept_count;
scanf("%ld", &dept_count);
vector<long> unite_cost;
long tmp;
for(int i=0; i<dept_count; i++){
scanf("%ld", &tmp);
unite_cost.push_back(tmp);
}
printf("%ld\n", get_multi(unite_cost));
printf("%ld\n", get_permu(dept_count));
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |