Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma GCC optimize("Ofast")
- #pragma GCC target("avx,avx2,fma")
- #include <bits/stdc++.h>
- /*
- struct Complex { double x, y; };
- Complex operator*(Complex lhs, Complex rhs) {
- return Complex{lhs.x * rhs.x - lhs.y * rhs.y, lhs.x * rhs.y + lhs.y * rhs.x};
- }
- Complex& operator+=(Complex& lhs, Complex rhs) {
- lhs.x += rhs.x;
- lhs.y += rhs.y;
- return lhs;
- }
- std::ostream& operator<<(std::ostream& os, Complex c) {
- std::cout << "(" << c.x << "," << c.y << ")";
- }
- */
- using Complex = std::complex<double>;
- int main() {
- std::mt19937 gen(123);
- std::uniform_real_distribution<double> dist(-1,1);
- std::vector<Complex> arr(25000);
- for (auto &it : arr) {
- it = Complex{dist(gen), dist(gen)};
- }
- Complex res{0,0};
- for (auto it : arr) {
- for (auto jt : arr) {
- res += it * jt;
- }
- }
- std::cout << res;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement