QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#206782#7558. Abstractucup-team206#Compile Error//C++14521b2023-10-07 22:44:142023-10-07 22:44:14

Judging History

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

  • [2023-10-07 22:44:14]
  • 评测
  • [2023-10-07 22:44:14]
  • 提交

answer

n, m = map(int, input().split())
a = list(map(int, input().split()))
g = [[] for i in range(n)]
deg = [0] * n
for i in range(m):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    g[x].append(y)
    deg[y] += 1
q = []
h = 0
for i in range(n):
    if deg[i] == 0:
        q.append(i)
ans = 0
while h < len(q):
    x = q[h]
    ans = a[x]
    h += 1
    for y in g[x]:
        a[y] += a[x] * 2
        deg[y] -= 1
        if deg[y] == 0:
            q.append(y)
print(len(bin(ans)) - 2)

Details

answer.code:1:1: error: ‘n’ does not name a type
    1 | n, m = map(int, input().split())
      | ^