Contest Duration: ~ (local time) (120 minutes) Back to Home

Submission #6903154

Source Code Expand

Copy
```#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
if res[-1] == "\n":
return res[:-1]
return res
def IR(n):
return [I() for i in range(n)]
def LIR(n):
return [LI() for i in range(n)]
def SR(n):
return [S() for i in range(n)]
def LSR(n):
return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
def comb(a,b):
if b > a:
return 0
return fact[a]*inv[b]*inv[a-b]%mod
def f(x,y):
return comb(x*y,k)
w,h = LI()
x,y = LI()
d,l = LI()
fact = [1]
for i in range(10000):
fact.append(fact[-1]*(i+1)%mod)
inv = [1]*10001
inv[10000] = pow(fact[10000],mod-2,mod)
for i in range(10000)[::-1]:
inv[i] = inv[i+1]*(i+1)%mod
k = d+l
ans = f(x,y)
if k != x*y:
ans = f(x,y)-2*f(x-1,y)-2*f(x,y-1)+f(x-2,y)+f(x,y-2)+4*f(x-1,y-1)-2*f(x-2,y-1)-2*f(x-1,y-2)+f(x-2,y-2)
ans %= mod
ans *= (w-x+1)*(h-y+1)
ans *= comb(k,d)
ans %= mod
print(ans)
return

#B
def B():
n = I()
d = LIR(n)
for i in range(n):
for j in range(n-1):
d[i][j+1] += d[i][j]
for j in range(n):
for i in range(n-1):
d[i+1][j] += d[i][j]
for i in range(n):
d[i].insert(0,0)
d.insert(0,[0]*(n+1))
f = [0]*(n**2+1)
for l in range(n):
for u in range(n):
for r in range(l+1,n+1):
w = r-l
for d_ in range(u+1,n+1):
h = d_-u
f[w*h] = max(f[w*h],d[r][d_]-d[r][u]-d[l][d_]+d[l][u])
q = I()
for i in range(n**2):
f[i+1] = max(f[i+1],f[i])
for i in range(q):
x = I()
print(f[x])
return

#C
def C():
def cross(a,b):
return a[0]*b[1]-a[1]*b[0]
def f(a,b,c,d):
v = (b[0]-a[0],b[1]-a[1])
u = (c[0]-a[0],c[1]-a[1])
u_ = (d[0]-a[0],d[1]-a[1])
if cross(v,u)*cross(v,u_) <= 0:
v = (d[0]-c[0],d[1]-c[1])
u = (a[0]-c[0],a[1]-c[1])
u_ = (b[0]-c[0],b[1]-c[1])
if cross(v,u)*cross(v,u_) <= 0:
return 1
return 0
return 0

p = LI()
a,b = [p[0],p[1]],[p[2],p[3]]
n = I()
p = LIR(n)
ans = 0
p.append(p[0])
for i in range(n):
c,d = p[i],p[i+1]
ans += f(a,b,c,d)
print((ans>>1)+1)
return

#D
def D():
w = I()
n,k = LI()
g = LIR(n)
dp = [[0]*(w+1) for i in range(k+1)]
for d in range(n):
a,b = g[d]
for i in range(1,k+1)[::-1]:
for j in range(a,w+1)[::-1]:
dp[i][j] = max(dp[i][j],dp[i-1][j-a]+b)
ans = 0
for i in range(k+1):
ans = max(ans,max(dp[i]))
print(ans)
return

#E
def E():
n,m = LI()
v = [[0]*n for i in range(n)]
for i in range(n):
v[i][i] = 1
for i in range(m):
x,y = LI()
x -= 1
y -= 1
v[x][y] = 1
v[y][x] = 1
m = 1<<n
ans = 0
for k in range(m):
bi = bin(k).count("1")
for i in range(n):
if not k&(1<<i):
continue
for j in range(n):
if not k&(1<<j):
continue
if not v[i][j]:
break
else:
continue
break
else:
ans = max(ans,bi)
print(ans)
return

#Solve
if __name__ == "__main__":
E()
```

#### Submission Info

Submission Time 2019-08-14 20:38:29+0900 D - 派閥 dn6049949 PyPy3 (2.4.0) 100 3953 Byte AC 255 ms 44656 KB

#### Judge Result

Set Name Score / Max Score Test Cases
all 100 / 100 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 00_sample_04.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt, test_44.txt, test_45.txt, test_46.txt, test_47.txt, test_48.txt, test_49.txt, test_50.txt, test_51.txt, test_52.txt, test_53.txt, test_54.txt, test_55.txt, test_56.txt, test_57.txt, test_58.txt, test_59.txt, test_60.txt, test_61.txt, test_62.txt, test_63.txt, test_64.txt, test_65.txt, test_66.txt, test_67.txt, test_68.txt, test_69.txt, test_70.txt
Case Name Status Exec Time Memory
00_sample_01.txt 204 ms 39408 KB
00_sample_02.txt 202 ms 39408 KB
00_sample_03.txt 205 ms 39408 KB
00_sample_04.txt 226 ms 42352 KB
test_01.txt 202 ms 39408 KB
test_02.txt 197 ms 39408 KB
test_03.txt 198 ms 39408 KB
test_04.txt 207 ms 39408 KB
test_05.txt 203 ms 39408 KB
test_06.txt 219 ms 39408 KB
test_07.txt 209 ms 39408 KB
test_08.txt 213 ms 40944 KB
test_09.txt 232 ms 42096 KB
test_10.txt 224 ms 41200 KB
test_11.txt 226 ms 42096 KB
test_12.txt 243 ms 42480 KB
test_13.txt 199 ms 39408 KB
test_14.txt 208 ms 39408 KB
test_15.txt 214 ms 40304 KB
test_16.txt 224 ms 42096 KB
test_17.txt 229 ms 42096 KB
test_18.txt 225 ms 42352 KB
test_19.txt 243 ms 43248 KB
test_20.txt 240 ms 42608 KB
test_21.txt 235 ms 42096 KB
test_22.txt 251 ms 42736 KB
test_23.txt 245 ms 42736 KB
test_24.txt 237 ms 42224 KB
test_25.txt 195 ms 39408 KB
test_26.txt 235 ms 42864 KB
test_27.txt 220 ms 41712 KB
test_28.txt 202 ms 39408 KB
test_29.txt 216 ms 40944 KB
test_30.txt 230 ms 41584 KB
test_31.txt 227 ms 42608 KB
test_32.txt 234 ms 42224 KB
test_33.txt 229 ms 42864 KB
test_34.txt 246 ms 42096 KB
test_35.txt 255 ms 43628 KB
test_36.txt 229 ms 42224 KB
test_37.txt 218 ms 41840 KB
test_38.txt 227 ms 42608 KB
test_39.txt 241 ms 42352 KB
test_40.txt 226 ms 41840 KB
test_41.txt 253 ms 44140 KB
test_42.txt 226 ms 42224 KB
test_43.txt 215 ms 41712 KB
test_44.txt 230 ms 41968 KB
test_45.txt 236 ms 42352 KB
test_46.txt 252 ms 42352 KB
test_47.txt 238 ms 42736 KB
test_48.txt 223 ms 42224 KB
test_49.txt 227 ms 42480 KB
test_50.txt 231 ms 42352 KB
test_51.txt 243 ms 41712 KB
test_52.txt 247 ms 42352 KB
test_53.txt 229 ms 41968 KB
test_54.txt 239 ms 41964 KB
test_55.txt 243 ms 43376 KB
test_56.txt 253 ms 44656 KB
test_57.txt 230 ms 42736 KB
test_58.txt 235 ms 42864 KB
test_59.txt 238 ms 42864 KB
test_60.txt 230 ms 42224 KB
test_61.txt 240 ms 43928 KB
test_62.txt 193 ms 39408 KB
test_63.txt 225 ms 41968 KB
test_64.txt 222 ms 42480 KB
test_65.txt 227 ms 41968 KB
test_66.txt 232 ms 42224 KB
test_67.txt 236 ms 42480 KB
test_68.txt 234 ms 42224 KB
test_69.txt 244 ms 41968 KB
test_70.txt 247 ms 42736 KB