QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#708898#2937. CIDRsefnuray#WA 16ms10704kbPython3635b2024-11-04 09:24:382024-11-04 09:24:39

Judging History

你现在查看的是最新测评结果

  • [2024-11-04 09:24:39]
  • 评测
  • 测评结果:WA
  • 用时:16ms
  • 内存:10704kb
  • [2024-11-04 09:24:38]
  • 提交

answer


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=1
for i in range(t):
    solve()

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 16ms
memory: 10692kb

input:

4
10.0.0.1
10.0.0.24
10.0.0.8
10.0.0.16

output:

27

result:

ok single line: '27'

Test #2:

score: 0
Accepted
time: 14ms
memory: 10696kb

input:

5
10.0.0.1
10.0.0.24
10.0.0.8
10.1.0.1
10.0.0.16

output:

15

result:

ok single line: '15'

Test #3:

score: 0
Accepted
time: 10ms
memory: 10588kb

input:

2
127.0.0.1
127.0.0.53

output:

26

result:

ok single line: '26'

Test #4:

score: 0
Accepted
time: 14ms
memory: 10704kb

input:

3
0.0.0.128
0.0.0.3
0.0.128.5

output:

16

result:

ok single line: '16'

Test #5:

score: 0
Accepted
time: 12ms
memory: 10580kb

input:

5
123.123.123.123
123.123.123.123
123.123.123.123
123.123.123.123
123.123.123.123

output:

32

result:

ok single line: '32'

Test #6:

score: -100
Wrong Answer
time: 11ms
memory: 10700kb

input:

5
128.0.0.1
192.192.192.1
224.255.255.255
240.1.1.1
248.3.243.254

output:

32

result:

wrong answer 1st lines differ - expected: '1', found: '32'