QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#69876#5247. Walizki [C]tygrysekCompile Error//C++141.5kb2023-01-03 02:37:422023-01-03 02:37:45

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-03 02:37:45]
  • 评测
  • [2023-01-03 02:37:42]
  • 提交

answer

import math
import numpy as np

n = int(input())

vk=[]
vvk=[]
vva=[]
vvb=[]
vkx=[]
vc=[]
va=[]
vb=[]
vac=[]
for i in range(n+1):
    vvk.append([])
    vva.append([])
    vvb.append([])
    va.append(int(0))
    vc.append(int(0))
    vb.append(int(0))
    vkx.append([0,0])
    vac.append(False)
vac[1]=True
va[1]=1
for i in range(n):
    linia = input()
    we = linia.split(" ")
    k=int(we[0])
    vkx[i+1][1]=k
    
    for j in range(k):
        b=int(we[j+1])
        vvk[i+1].append(b)
  
if vkx[1]==0:
    print("1")
else:
    vc[1]=vkx[1][1]
   
    vva[1].append(1)
    vvb[1].append(1)
    for i in range(n):
        if vac[i+1] and (vkx[i+1][1]>0):
            a=1
            k=1
            for j in range(len(vva[i+1])):
                a=math.gcd(int(k),int(vva[i+1][j]))
                k*=vva[i+1][j]
                k//=a
            va[i+1]=0
            for j in range(len(vva[i+1])):
                va[i+1]+=((k//vva[i+1][j])*vvb[i+1][j])
            vc[i+1]=va[i+1]*vkx[i+1][1]
            a=math.gcd(int(va[i+1]),int(vkx[i+1][1]))
            vc[i+1]//=a
            vc[i+1]//=va[i+1]
            vc[i+1]*=k

            c=((vc[i+1]//k)*va[i+1])//vkx[i+1][1]

            for j in range(len(vvk[i+1])):
                vva[vvk[i+1][j]].append(vc[i+1])
                vvb[vvk[i+1][j]].append(c)
                vac[vvk[i+1][j]]=True

    z=1
    for i in range(n):
        if vc[i+1]>1:
            a=math.gcd(int(z),int(vc[i+1]))
            z*=vc[i+1]//a
            
    print(int(z))

詳細信息

answer.code:1:1: error: ‘import’ does not name a type
    1 | import math
      | ^~~~~~
answer.code:1:1: note: C++20 ‘import’ only available with ‘-fmodules-ts’