Submission #389414

#TimeUsernameProblemLanguageResultExecution timeMemory
389414casperwangXOR Sum (info1cup17_xorsum)C++14
18 / 100
1695 ms58660 KiB
#include <bits/stdc++.h> #define int long long #define pb emplace_back #define pii pair<int,int> #define ff first #define ss second using namespace std; #define debug(args...) kout("[ " + string(#args) + " ]", args) void kout() { cerr << endl; } template <class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ',kout(b...); } template <class T> void pary(T L, T R) { while (L != R) cerr << *L << " \n"[++L==R]; } const int MAXN = 1000000; int N; int a[MAXN+1]; map <int,int> val; vector <pii> arr; int ans; signed main() { ios_base::sync_with_stdio(0), cin.tie(0); cin >> N; for (int i = 1; i <= N; i++) { cin >> a[i]; val[a[i]]++; } for (auto [v, c] : val) arr.pb(v, c); for (int i = 0; i < arr.size(); i++) { if ((arr[i].ss * (arr[i].ss + 1) / 2) % 2) ans ^= arr[i].ff + arr[i].ff; for (int j = 0; j < i; j++) { if (arr[i].ss * arr[j].ss % 2 == 0) continue; ans ^= arr[i].ff + arr[j].ff; } } cout << ans << '\n'; return 0; }

Compilation message (stderr)

xorsum.cpp: In function 'int main()':
xorsum.cpp:27:12: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   27 |  for (auto [v, c] : val) arr.pb(v, c);
      |            ^
xorsum.cpp:28:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |  for (int i = 0; i < arr.size(); i++) {
      |                  ~~^~~~~~~~~~~~
#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...