# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
200857 | jh05013 | 씽크스몰 (kriii3_TT) | C++17 | 2137 ms | 211668 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.
#include <bits/stdc++.h>
#define sz(X) (int)((X).size())
#define entire(X) X.begin(),X.end()
using namespace std; typedef long long ll;
void OJize(){cin.tie(NULL);ios_base::sync_with_stdio(false);}
template <class T1, class T2>ostream&operator<<(ostream &os,pair<T1,T2>const&x){os<<'('<<x.first<<", "<<x.second<<')';return os;}
template <class Ch, class Tr, class Container>basic_ostream<Ch,Tr>&operator<<(basic_ostream<Ch,Tr>&os,Container const&x){for(auto&y:x)os<<y<<" ";return os;}
const double PI = acos(-1);
typedef complex<double> CD;
typedef vector<CD> VCD;
typedef vector<ll> poly;
void FFT(VCD &A, bool inv){
int n = A.size();
for(int i=1, j=0; i<n; i++){
for(int k=n>>1; (j^=k)<k; k>>= 1);
if(i < j) swap(A[i], A[j]);
}
double ang = 2*PI / n * (inv? -1:1);
VCD roots(n/2);
for(int i=0; i<n/2; i++)
roots[i] = CD(cos(ang*i), sin(ang*i));
for(int i=2; i<=n; i<<= 1){
int step = n/i;
for(int j=0; j<n; j+=i) for(int k=0; k<i/2; k++){
CD u = A[j+k], v = A[j+k+i/2] * roots[step*k];
A[j+k] = u+v, A[j+k+i/2] = u-v;
}
}
if(inv) for(int i=0; i<n; i++) 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... |