You are on page 1of 1

5/21/22, 7:02 PM Problem - D - Codeforces

alfa_flex
| Logout

  HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP  
 
 

PROBLEMS SUBMIT CODE MY SUBMISSIONS STATUS STANDINGS CUSTOM INVOCATION

  Mashup  
D. Count Permutations Contest is running
time limit per test: 1 second
04:57:05
memory limit per test: 256 megabytes
input: standard input Contestant
output: standard output

You are given an array a consisting n distinct integers.


  → Submit?  
We define an array b of length m to be good if bi ≥ i for all i (1 ≤ bi ≤ m) .

How many permutations of a are good? Language: GNU G++17 7.3.0

Since number of permutations can be extremeply large, please print it modulo 998244353 . Choose
Choose File No file chosen
file:

Input
Submit
The first line contains a single integer n(1 ≤ n ≤ 1000) , the length of the array a.

The second line of each test case contains n distinct integers a1 , a2 , … , an


(1 ≤ ai ≤ 10 )
9
— the elements of array a.

Output
Print number of permutations of a that are good.

Example
input Copy

2 4 3

output Copy

Codeforces (c) Copyright 2010-2022 Mike Mirzayanov


The only programming contests Web 2.0 platform
Server time: May/21/2022 19:02:55UTC+5.5 (k3).
Desktop version, switch to mobile version.
Privacy Policy

Supported by

https://codeforces.com/gym/382540/problem/D 1/1

You might also like