Skip to content

Instantly share code, notes, and snippets.

@uchidama
Created July 12, 2021 02:51
Show Gist options
  • Save uchidama/c74156f5673fae4e8285807c08c8297d to your computer and use it in GitHub Desktop.
Save uchidama/c74156f5673fae4e8285807c08c8297d to your computer and use it in GitHub Desktop.
AtCoder Beginner Contest 209 [ C - Not Equal ] https://atcoder.jp/contests/abc209/tasks/abc209_c
'''
[問題]
https://atcoder.jp/contests/abc209/tasks/abc209_c
'''
import sys
sys.setrecursionlimit(10 ** 6) # 再帰上限の引き上げ
input = sys.stdin.readline
INF = 2 ** 63 - 1
N = int(input())
C = list(map(int, input().split()))
C.sort()
ans = 1
for i,j in enumerate(C):
ans = ans * (j - i) % (10**9+7)
# 最後にまとめて余り計算はTLE
#ans *= (j - i)
print(ans)
# 最後にまとめて余り計算はTLE
#print(ans%(10**9+7))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment