QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#708893 | #2937. CIDR | sefnuray# | RE | 0ms | 0kb | Python3 | 1.4kb | 2024-11-04 09:19:19 | 2024-11-04 09:19:20 |
answer
import sys #importing libraries
import math
import queue
import itertools
import heapq
from collections import defaultdict
MOD= int(1e9 + 7)
input = sys.stdin.readline
cnt=defaultdict(int)
def readString():
s=input()
return list(s[:len(s) - 1])
def outList(res):
for r in res[:-1]:
sys.stdout.write(str(r)+" ")
sys.stdout.write(str(res[-1])+"\n")
def out(output):
sys.stdout.write(str(output)+"\n")
def outE(output):
sys.stdout.write(str(output))
def comb(n, r):
if r == 0 or n == 0:
return 1
if r > n // 2:
return comb(n, n - r)
res = 1
for k in range(1, r + 1):
res *= n - k + 1
res //= k
return res
def solve():
# read
n= int(input())
parts=[]
for i in range(4):
parts.append([])
for i in range(n):
d= input()
bits= [int(i) for i in d.split('.')]
for i,b in enumerate(bits):
parts[i].append(b)
ans=0
for i,p in enumerate(parts):
if(len(set(p))==1):
ans+=8
continue
zeros=0
for n in p:
b= bin(n)[2:]
zeros=max(len(b),zeros)
ans+=(8-zeros)
break
if(ans==0):
ans=32
print(ans)
return
t= int(input())
t=1
for i in range(t):
solve()
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Dangerous Syscalls
input:
4 10.0.0.1 10.0.0.24 10.0.0.8 10.0.0.16