# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1086414 | shikgom2 | 씽크스몰 (kriii3_TT) | Pypy 3 | 1139 ms | 164296 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
import math
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]
angle = -2 * math.pi if inv else 2 * math.pi
length = 2
while length <= n:
w = [cmath.exp(angle / length * i * 1j) for i in range(length // 2)]
for i in range(0, n, length):
for j in range(length // 2):
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:
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |