Cod sursa(job #3157808)

Utilizator toma_ariciuAriciu Toma toma_ariciu Data 16 octombrie 2023 21:39:06
Problema Grigo Scor 100
Compilator cpp-64 Status done
Runda HLO 2023 - Lot - Tema 0 Marime 0.64 kb
#include <iostream>
#include <algorithm>

using namespace std;

const int mod = 1000003;
bool poz[100005];
int n, m, ans;

int main() {
    #ifdef LOCAL
        freopen("test.in", "r", stdin);
        freopen("test.out", "w", stdout);
    #else
        freopen("grigo.in", "r", stdin);
        freopen("grigo.out", "w", stdout);
    #endif // LOCAL
    cin >> n >> m;
    for (int i = 1; i <= m; i++) {
        int x;
        cin >> x;
        poz[x - 1] = 1;
    }
    ans = 1;
    for (int i = 1; i < n; i++) {
        if (!poz[i]) {
            ans = (1LL * ans * i) % mod;
        }
    }
    cout << ans;
    return 0;
}