답안 #433203

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
433203 2021-06-19T07:52:48 Z hhhhaura XOR Sum (info1cup17_xorsum) C++14
11 / 100
103 ms 4552 KB
#define wiwihorz
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma loop-opt(on)

#define rep(i, a, b) for(int i = a; i <= b; i ++)
#define rrep(i, a, b) for(int i = b; i >= a; i--)
#define all(x) x.begin(), x.end()
#define ceil(a, b) ((a + b - 1) / (b))

#define INF 1000000000000000000
#define MOD 1000000007
#define eps (1e-9)

using namespace std;

#define int long long int
#define lld long double
#define pii pair<int, int>
#define random mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count())

#ifdef wiwihorz
#define print(a...) kout("[" + string(#a) + "] = ", a) 
void vprint(auto L, auto R) { while(L < R) cerr << *L << " \n"[next(L) == R], ++L;}
void kout() { cerr << endl; }
template<class T1, class ... T2> void kout(T1 a, T2 ... e) { cerr << a << " ", kout(e...); }
#else
#define print(...) 0
#define vprint(...) 0
#endif
namespace solver {
	int n, mx = 4000;
	vector<int> cnt;
	void init_() {
		cnt.assign(mx + 1, 0);
	}
	int solve() {
		int ans = 0;
		rep(i, 0, mx) {
			int tot = cnt[i] + cnt[i] * (cnt[i] - 1) / 2;
			if(tot & 1) ans ^= 2 * i;
			cnt[i] = cnt[i] & 1;
		}
		rep(i, 0, mx) rep(j, i + 1, mx) {
			if(cnt[i] && cnt[j]) ans ^= (i + j);
		}
		return ans;
	}

};
using namespace solver;
signed main() {
	ios::sync_with_stdio(false), cin.tie(0);
	int n; cin >> n;
	init_();
	rep(i, 1, n) {
		int x; cin >> x;
		cnt[x] ++;
	}	
	cout << solve() << "\n";
	return 0;
}

Compilation message

xorsum.cpp:4: warning: ignoring '#pragma loop ' [-Wunknown-pragmas]
    4 | #pragma loop-opt(on)
      | 
xorsum.cpp:24:13: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   24 | void vprint(auto L, auto R) { while(L < R) cerr << *L << " \n"[next(L) == R], ++L;}
      |             ^~~~
xorsum.cpp:24:21: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   24 | void vprint(auto L, auto R) { while(L < R) cerr << *L << " \n"[next(L) == R], ++L;}
      |                     ^~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 460 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 103 ms 332 KB Output is correct
2 Correct 97 ms 4552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 103 ms 332 KB Output is correct
2 Correct 97 ms 4552 KB Output is correct
3 Runtime error 2 ms 460 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 460 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 460 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -