卬高杯
提出id | 提出時刻 | ユーザー名 | 問題 | 言語 | 判定状況 | 判定 | 実行時間 |
---|---|---|---|---|---|---|---|
114905 | 2023-10-24 12:35:31 | U_S | I | python | 25/25 | TLE | 2003 |
import sys
sys.setrecursionlimit(10**7)
# input = sys.stdin.readline
# import pypyjit
# pypyjit.set_param('max_unroll_recursion=-1')
def mp():return map(int,input().split())
def lmp():return list(map(int,input().split()))
def lm1(LIST): return list(map(lambda x:x-1, LIST))
def mps(A):return [tuple(map(int, input().split())) for _ in range(A)]
def stoi(LIST):return list(map(int,LIST))
def itos(LIST):return list(map(str,LIST))
def atoi(LIST): return [ord(i)-ord("a") for i in LIST]
def Atoi(LIST): return [ord(i)-ord("A") for i in LIST]
def bitA(X,A):return X & 1<<A == 1<<A
import math
import bisect
import heapq
import time
from copy import copy as cc
from copy import deepcopy as dc
from itertools import accumulate, product
from collections import Counter, defaultdict, deque
def ceil(U,V):return (U+V-1)//V
def modf1(N,MOD):return (N-1)%MOD+1
inf = (1<<63)-1
mod = 127237991
n = int(input())
a = [lmp() for i in range(5)]
for i in a:
i.sort()
def f(x,y):
if visit[x][y]:return memo[x][y]
if x == 4:return 1
m = bisect.bisect_right(a[x+1],a[x][y])
if m == n:return 0
cnt = 0
for i in range(m,n):
cnt += f(x+1,i)
cnt %= mod
memo[x][y] *= cnt
memo[x][y] %= mod
#print(memo)
visit[x][y] = True
return memo[x][y]
ans = 0
memo = [[1]*n for i in range(5)]
visit = [[False]*n for i in range(5)]
for i in range(n):
ans += f(0,i)%mod
#print(memo)
print(ans%mod)
sample1.txt AC 18 sample2.txt AC 19 sample3.txt AC 38 sample4.txt AC 20 sample5.txt AC 28 case1.txt AC 41 case2.txt AC 30 case3.txt AC 35 case4.txt AC 23 case5.txt AC 20 case6.txt TLE 2002 case7.txt TLE 2002 case8.txt TLE 2002 case9.txt TLE 2002 case10.txt TLE 2002 case11.txt TLE 2003 case12.txt TLE 2003 case13.txt TLE 2003 case14.txt TLE 2003 case15.txt TLE 2003 case16.txt TLE 2003 case17.txt TLE 2003 case18.txt TLE 2003 case19.txt TLE 2003 case20.txt TLE 2003 2003 TLE