Submission #31412

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
314122017-08-21 15:26:58gs14004카드 (kriii4_Z)C++14
13 / 100
1000 ms2656 KiB
#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> &v, bool inv){
int n = v.size();
vector<base> w(n/2), aux(n);
for(int i=0; i<n/2; i++){
int k = i&-i;
if(i == k){
double ang = 2 * M_PI * i / n;
if(inv) ang *= -1;
w[i] = base(cos(ang), sin(ang));
}
else w[i] = w[i-k] * w[k];
}
for(int i=n/2; i; i>>=1){
aux = v;
for(int k=0; 2*k<n; k+=i){
for(int j=0; j<i; j++){
base a = aux[2*k + j], b = aux[2*k + j + i] * w[k];
v[k + j] = a + b;
v[k + j + n/2] = a - b;
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

Z.cpp: In function 'std::vector<long long int> fft::multiply(std::vector<long long int>&, std::vector<long long int>&)':
Z.cpp:41:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while(n < max(v.size(), w.size())) n <<= 1;
           ^
Z.cpp: In function 'std::vector<long long int> fft::multiply(std::vector<long long int>&, std::vector<long long int>&, int)':
Z.cpp:64:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while(n < max(v.size(), w.size())) n <<= 1;
           ^
Z.cpp:67:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0; i<v.size(); i++){
                 ^
Z.cpp:71:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0; i<w.size(); i++){
                 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...