제출 #440539

#제출 시각아이디문제언어결과실행 시간메모리
440539zxcvbnmXOR Sum (info1cup17_xorsum)C++14
7 / 100
1693 ms8836 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<int> a(n); for(int i = 0; i < n; i++) { cin >> a[i]; } vector<int> cnt(32, 0); vector<int> p(32); p[0] = 1; for(int i = 1; i < 31; i++) { p[i] = p[i-1] * 2; // cout << p[i] << "\n"; } for(int i = 0; i < n; i++) { for(int j = i; j < n; j++) { int x = a[i] + a[j]; // cout << x << "\n"; for(int k = 0; k < 31; k++) { if (x & (p[k])) { cnt[k]++; } } } } ll ans = 0; for(int i = 0; i < 31; i++) { if (cnt[i] % 2) { ans += p[i]; } } cout << ans << "\n"; // for(int i = 0; i < n; i++) { // for(int j = 0; j < 31; j++) { // if (a[i] & p[j]) { // cnt[j]++; // } // } // } // for(int i = 0; i < 6; i++) { // cout << cnt[i] << " "; // } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...