# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
31419 | gs14004 | 카드 (kriii4_Z) | C++14 | 549 ms | 3276 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>
using namespace std;
typedef long long lint;
typedef pair<int, int> pi;
const int MAXN = 3005;
const int mod = 1e9 + 7;
namespace fft{
typedef complex<double> base;
void fft(vector<base> &a, bool inv){
int n = a.size(), j = 0;
for(int i=1; i<n; i++){
int bit = (n >> 1);
while(j >= bit){
j -= bit;
bit >>= 1;
}
j += bit;
if(i < j) swap(a[i], a[j]);
}
for(int i=2; i<=n; i<<=1){
double ang = 2 * acos(-1) / i * (inv ? -1 : 1);
base x(cos(ang), sin(ang));
for(int j=0; j<n; j+=i){
base y(1);
for(int k=0; k<i/2; k++){
base u = a[j+k], v = a[j+k+i/2] * y;
a[j+k] = u+v;
a[j+k+i/2] = u-v;
y *= x;
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |