# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
31416 | gs14004 | 카드 (kriii4_Z) | C++14 | 499 ms | 6564 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<long double> base;
void fft(vector<base> &a, bool inv){
int j = 0;
for(int i=1; i<a.size(); i++){
int bit = a.size() >> 1;
while(j >= bit){
j -= bit;
bit >>= 1;
}
j += bit;
if(i < j) swap(a[i], a[j]);
}
for(int i=2; i<=a.size(); i<<=1){
double w = 2 * M_PI / i * (inv ? -1 : 1);
base x = base(cos(w), sin(w));
for(int j=0; j<a.size(); j+=i){
base y = base(1);
for(int k=0; k<i/2; k++){
base u = a[j + k], v = a[j + k + i / 2];
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... |