Submission #1084061

#TimeUsernameProblemLanguageResultExecution timeMemory
1084061IzzyBosses (BOI16_bosses)C++14
Compilation error
0 ms0 KiB
def test(start): visited = [False for i in range(n)] levels = [[start]] lvl = 0 pos = 0 salary = 0 visited[start] = True while lvl < len(levels): # print(levels, salary) start = levels[lvl][pos] if start in arr: for i in arr[start]: if not visited[i]: visited[i] = True if len(levels) > lvl + 1: levels[lvl + 1].append(i) else: levels.append([i]) pos += 1 if pos == len(levels[lvl]): salary += len(levels[lvl]) * (pos + 1) lvl += 1 pos = 0 a = set(visited) if True in a and len(a) == 1: # print(levels) return salary return float('inf') salary = float('inf') n = int(input()) arr = {} for i in range(n): x = [int(i) - 1 for i in input().split(' ')[1:]] for j in x: if j in arr: arr[j].append(i) else: arr[j] = [i] for i in arr: salary = min(salary, test(i)) print(salary)

Compilation message (stderr)

bosses.cpp:9:11: error: invalid preprocessing directive #print
    9 |         # print(levels, salary)
      |           ^~~~~
bosses.cpp:26:11: error: invalid preprocessing directive #print
   26 |         # print(levels)
      |           ^~~~~
bosses.cpp:28:18: warning: multi-character character constant [-Wmultichar]
   28 |     return float('inf')
      |                  ^~~~~
bosses.cpp:30:16: warning: multi-character character constant [-Wmultichar]
   30 | salary = float('inf')
      |                ^~~~~
bosses.cpp:1:1: error: 'def' does not name a type
    1 | def test(start):
      | ^~~
bosses.cpp:33:1: error: expected unqualified-id before 'for'
   33 | for i in range(n):
      | ^~~