Submission #346628

# Submission time Handle Problem Language Result Execution time Memory
346628 2021-01-10T12:59:31 Z Alexandra Poi (IOI09_poi) Python 3
40 / 100
2000 ms 38440 KB
(n, t, p) = input().split()
(n, t , p) = int (n), int(t), int (p)
problems_solved = []
grading = []
scores=[]
empates=[]
PorEncima=0
TieBreak1=[]
TieBreak2=[]

for i in range (n):
  a = input().split()
  a = list(map(int, a))
  problems_solved.append(a)

for i in range (t):
  a = 0
  for j in range (n):
    a += problems_solved[j][i]
  grading.append(n - a)

for i in range(n):
  a = 0
  for j in range(t):
    if problems_solved[i][j]==1:
      a += grading[j]
  scores.append(a)

score_Philip = scores[p-1]

for i in range(n):
  if (i+1)==p:
    continue
  else:
    if score_Philip == scores[i]:
      empates.append(i+1)
      a = 0
      for j in range (t):
        a += problems_solved[i][j]
      TieBreak1.append(a)
    elif score_Philip < scores[i]:
      PorEncima += 1

if empates==[]:
  print (str(score_Philip) + " " + str(1+PorEncima))
else:
  empates.append(p)
  a=0
  for i in range (t):
    a += problems_solved[p-1][i]
  TieBreak1.append(a)

  for i in range(len(empates)-1):
    if TieBreak1[i] == TieBreak1[(len(empates)-1)]:
      TieBreak2.append(empates[i])
    elif TieBreak1[i] < TieBreak1[len(empates-1)]:
      PorEncima += 1
  
  if (TieBreak2)==[]:
    print (str(score_Philip) + " " + str(1+PorEncima))
  else:
    TieBreak2.append(p)
    TieBreak2.sort()
    a=TieBreak2.index(p)
    print (str(score_Philip) + " " + str(1+PorEncima+a))
# Verdict Execution time Memory Grader output
1 Correct 17 ms 3052 KB Output is correct
2 Correct 17 ms 3052 KB Output is correct
3 Runtime error 17 ms 3052 KB Execution failed because the return code was nonzero
4 Runtime error 17 ms 3052 KB Execution failed because the return code was nonzero
5 Runtime error 18 ms 3052 KB Execution failed because the return code was nonzero
6 Correct 18 ms 3052 KB Output is correct
7 Runtime error 21 ms 3052 KB Execution failed because the return code was nonzero
8 Runtime error 23 ms 3052 KB Execution failed because the return code was nonzero
9 Runtime error 29 ms 3180 KB Execution failed because the return code was nonzero
10 Correct 44 ms 3356 KB Output is correct
11 Correct 103 ms 4204 KB Output is correct
12 Correct 164 ms 5228 KB Output is correct
13 Runtime error 474 ms 9324 KB Execution failed because the return code was nonzero
14 Runtime error 681 ms 12012 KB Execution failed because the return code was nonzero
15 Runtime error 1234 ms 19692 KB Execution failed because the return code was nonzero
16 Correct 1284 ms 21032 KB Output is correct
17 Correct 1886 ms 27824 KB Output is correct
18 Execution timed out 2066 ms 30508 KB Time limit exceeded
19 Execution timed out 2074 ms 38440 KB Time limit exceeded
20 Execution timed out 2079 ms 38336 KB Time limit exceeded