fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. int main() {
  6. int num[200000];
  7. int N,a;
  8. cin >> N;
  9. for(int i=0;i<N;i++)
  10. {
  11. cin >> a;
  12. num[i] = a%100000007;
  13. }
  14. sort(num,num+N);
  15. int now = 0;
  16. long long ans=1;
  17. for(int i=0;i<N;i++)
  18. {
  19. ans = ans * (num[i]-now)%100000007;
  20. now++;
  21. }
  22. cout<<ans;
  23. }
Success #stdin #stdout 0.01s 5544KB
stdin
10
999999917 999999914 999999923 999999985 999999907 999999965 999999914 999999908 999999951 999999979
stdout
63122538