Cod sursa(job #3162354)

Utilizator vladburacBurac Vlad vladburac Data 28 octombrie 2023 23:51:52
Problema Grigo Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.65 kb
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int SIGMA = 26;
const int NMAX = 1e5;
const int MOD = 1000003;

#ifndef HOME
  ifstream fin( "grigo.in" );
  ofstream fout( "grigo.out" );
  #define cin fin
  #define cout fout
#endif // HOME

int v[NMAX+1];
int main() {
  ios_base::sync_with_stdio( false );
  cin.tie( NULL );
  cout.tie( NULL );
  int n, m, i, x;
  cin >> n >> m;
  for( i = 0; i < m; i++ ) {
    cin >> x;
    v[x] = 1;
  }
  ll ans = 1;
  int disp = n;
  for( i = n; i >= 1; i-- ) {
    if( v[i] == 0 )
      ans = ans * ( disp - 1 ) % MOD;
    disp--;
  }
  cout << ans;
  return 0;
}