这个会报错怎么办 他说快速幂那里complex不是个类型怎么办
#include<bits/stdc++.h>
#define int long long
using namespace std;
int c, K;
int II;
struct complex {
int real, imag;
complex(int real = 0, int imag = 0):real(real), imag(imag){}
bool operator == (complex y) {
return real == y.real and imag == y.imag;
}
complex operator * (complex y) {
return complex(real * y.real % K + II * imag * y.imag % K % K, (imag*y.real%K+real*y.imag%K) % K);
}
};
complex Pow(complex idx, int P) {
if(P == 0) return {1, 0};
if(P == 1) return idx;
int u = Pow(idx, P/2);
if(P&1) return u*u*idx;
else return u*u;
}
bool check(complex idx) {
if(Pow(idx, (K-1)/2) == 1) {
return true;
} else {
return false;
}
}
signed main() {
ios::sync_with_stdio(0); cin.tie(0);
int t; cin >> t;
while(t--) {
cin >> c >> K;
int a = rand()%K;
while(check(a)) {
a = rand()%K;
}
II = (a*a-c+K) % K;
int x0 = int(Pow(complex(a,1), (mod+1)>>1).real);
int x1 = (K-x0) % K;
if(x0 == x1) cout << x1 << endl;
else cout << x0 << " " << x1 << endl;
}
return 0;
}