# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1086413 | shikgom2 | 씽크스몰 (kriii3_TT) | Pypy 3 | 1129 ms | 167368 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
import sys
input = sys.stdin.readline
import cmath
def fft(a, inv):
n = len(a)
j = 0
for i in range(1, n):
bit = n >> 1
while j >= bit:
j -= bit
bit >>= 1
j += bit
if i < j:
a[i], a[j] = a[j], a[i]
length = 2
while length <= n:
w = [cmath.exp(2j * cmath.pi * i / length * (-1 if inv else 1)) for i in range(length >> 1)]
for i in range(0, n, length):
for j in range(length >> 1):
u = a[i + j]
v = a[i + j + length // 2] * w[j]
a[i + j] = u + v
a[i + j + length // 2] = u - v
length <<= 1
if inv:
for i in range(n):
a[i] /= n
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |