답안 #163824

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
163824 2019-11-15T14:39:42 Z boolodifjenula Izbori (COCI17_izbori) Python 3
52 / 80
29 ms 3428 KB
N,M,K=map(int,input().split())
L=[]
G=M*[0]
for i in range (N):
    L+=[list(map(int,input().split()))]
    G[L[i][0]-1]+=1
n=0
for i in range(M):
    if G[i]>G[n]:
        n=i
print(n+1)
if n+1==K:
    print(0)
else:
    p=0
    P=[0]
    for i in range(100):
        p+=1
        P+=[n+1]
        G[n]=0
        for x in range(N):
            for y in range(M):
                if L[x][y] in P:
                    L[x][y]=0
                else:
                    G[L[x][y]-1]+=1
                    break
        n=0
        for i in range(M):
            if G[i]>G[n]:
                n=i
        if n+1==K:
            print(p-1)
            break
                
                    
     
    
    
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 3336 KB Output is correct
2 Partially correct 26 ms 3428 KB Partially correct
3 Partially correct 28 ms 3428 KB Partially correct
4 Correct 28 ms 3428 KB Output is correct
5 Partially correct 27 ms 3428 KB Partially correct
6 Partially correct 26 ms 3428 KB Partially correct
7 Partially correct 25 ms 3300 KB Partially correct
8 Correct 25 ms 3428 KB Output is correct
9 Partially correct 26 ms 3332 KB Partially correct
10 Partially correct 26 ms 3428 KB Partially correct
11 Correct 25 ms 3332 KB Output is correct
12 Partially correct 27 ms 3428 KB Partially correct
13 Partially correct 27 ms 3336 KB Partially correct
14 Partially correct 26 ms 3428 KB Partially correct
15 Correct 25 ms 3332 KB Output is correct
16 Correct 26 ms 3336 KB Output is correct
17 Partially correct 27 ms 3428 KB Partially correct
18 Partially correct 28 ms 3400 KB Partially correct
19 Partially correct 27 ms 3336 KB Partially correct
20 Partially correct 29 ms 3336 KB Partially correct