답안 #389414

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
389414 2021-04-14T04:03:25 Z casperwang XOR Sum (info1cup17_xorsum) C++14
18 / 100
1600 ms 58660 KB
#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

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++) {
      |                  ~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 716 KB Output is correct
2 Correct 10 ms 716 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 203 ms 8432 KB Output is correct
2 Correct 198 ms 7968 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 203 ms 8432 KB Output is correct
2 Correct 198 ms 7968 KB Output is correct
3 Execution timed out 1695 ms 58660 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 716 KB Output is correct
2 Correct 10 ms 716 KB Output is correct
3 Execution timed out 1676 ms 9508 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 716 KB Output is correct
2 Correct 10 ms 716 KB Output is correct
3 Correct 203 ms 8432 KB Output is correct
4 Correct 198 ms 7968 KB Output is correct
5 Execution timed out 1695 ms 58660 KB Time limit exceeded
6 Halted 0 ms 0 KB -