Submission

Status:
PPPPPPPPPP

Score: 100

User: Nagorn

Problemset: H.Weird Ping-pong

Language: cpp

Time: 0.147 second

Submitted On: 2024-10-15 08:13:29

#include <bits/stdc++.h>
#define int long long
using namespace std;
const int mod = 1e9 + 7;
int32_t main(){
    cin.tie(NULL)->sync_with_stdio(false);
    int n;
    cin >> n;
    vector <int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    int ans = 1;
    int cnt = 0;
    for(int i = 0; i < n; i++){
        ans = (ans * ((a[i] - i) % mod)) % mod;
    }
    cout << ans;
}