Logo
(追記) (追記ここまで)

30171번 - Another Filling the Grid 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB25191789.474%

문제

You have $n \times n$ square grid and an integer $k$. Put an integer in each cell while satisfying the conditions below.

  • All numbers in the grid should be between 1ドル$ and $k$ inclusive.
  • Minimum number of the $i$-th row is 1ドル$ (1ドル \le i \le n$).
  • Minimum number of the $j$-th column is 1ドル$ (1ドル \le j \le n$).

Find the number of ways to put integers in the grid. Since the answer can be very large, find the answer modulo $(10^{9} + 7)$.

These are the examples of valid and invalid grid when $n=k=2$.

입력

The only line contains two integers $n$ and $k$ (1ドル \le n \le 250,ドル 1ドル \le k \le 10^{9}$).

출력

Print the answer modulo $(10^{9} + 7)$.

제한

예제 입력 1

2 2

예제 출력 1

7

예제 입력 2

123 456789

예제 출력 2

689974806

노트

In the first example, following 7ドル$ cases are possible.

In the second example, make sure you print the answer modulo $(10^{9} + 7)$.

출처

Contest > Codeforces > Codeforces Round 589 (Div. 2) E번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /