Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* e275 */
- /* AC (0.1s, 116KB) */
- #pragma warning( disable : 4996 )
- #include <cstdio>
- #include <cstring>
- #include <cstdint>
- #include <cmath>
- #include <algorithm>
- #include <tuple>
- #define ios_jazz ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
- using namespace std;
- using int16 = short;
- using uint16 = unsigned short;
- using int32 = int;
- using uint = unsigned int;
- using int64 = long long;
- using uint64 = unsigned long long;
- using pii = pair<int, int>;
- /* main code */
- bool isParityZero(uint64 x)
- {
- for (int i = 32; i; i >>= 1)
- x = x ^ (x >> i);
- return !(x & 1);
- }
- constexpr uint MAXN = 100000;
- uint n, arr[2];
- uint64 x;
- int main()
- {
- while (~scanf("%u", &n))
- {
- arr[0] = arr[1] = 0;
- for (uint i = 0; i < n; ++i)
- {
- scanf("%llu", &x);
- ++arr[!isParityZero(x)];
- }
- if (n == 1)
- puts("0");
- else
- printf("%llu\n", (uint64)n * (n - 1) / 2 - arr[0] * arr[1]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment