| ps | |
|---|---|
| 링크 | acmicpc.net/… |
| 출처 | BOJ |
| 문제 번호 | 25556 |
| 문제명 | My뷰 꾸미기 |
| 레벨 | 플래티넘 4 |
| 분류 |
조합론 |
| 시간복잡도 | O(n) |
| 인풋사이즈 | n<=300,000 |
| 사용한 언어 | Python 3.13 |
| 제출기록 | 84244KB / 716ms |
| 최고기록 | 700ms |
| 해결날짜 | 2026/01/28 |
"""Solution code for "BOJ 25569. My뷰 꾸미기".
- Problem link: https://www.acmicpc.net/problem/25569
- Solution link: http://www.teferi.net/ps/problems/boj/25569
Tags: [combinatorics]
"""
import sys
from teflib import combinatorics
MOD = 10**9 + 7
def main():
N = int(sys.stdin.readline())
answer = 1
cc = combinatorics.CombCalculator(MOD)
for _ in range(N):
A, B = [int(x) for x in sys.stdin.readline().split()]
large, small = (A, B) if A > B else (B, A)
answer = answer * (cc.comb(large + small, small) - 1) % MOD
print(answer)
if __name__ == '__main__':
main()