QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#140621#4810. Add OneWilliamsWA 1ms3636kbC++142.2kb2023-08-16 14:20:252023-08-16 14:20:27

Judging History

你现在查看的是最新测评结果

  • [2023-08-16 14:20:27]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3636kb
  • [2023-08-16 14:20:25]
  • 提交

answer

#include <bits/stdc++.h>
#define for_(i,a,b) for (int i = (a); i < (b); i++)
#define rep_(i,a,b) for (int i = (a); i <= (b); i++)
#define per_(i,a,b) for (int i = (a); i >= (b); i--)
#define pii pair<int, int>
#define pll pair<ll, ll> 
#define fi first
#define se second
#define ll long long
#define sz(a) (int)a.size()
#define all(v) v.begin(), v.end()
#define clr(x) memset(x, 0, sizeof(x))
#define wls(v)   sort(all(v)); v.erase(unique(all(v)), v.end());
#define ull unsigned long long
#define pb push_back
#define D(x) cerr << #x << '=' << x << endl
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"]=";rep_(_x,(L),(R))cerr<<a[_x]<<" "; cerr<<endl; 
	#ifdef LOCAL
#define line cout << "--------------------------------" << endl;
#define CE cout << endl;
#define CO cout << "OK" << endl;
    #endif
#define endl '\n'
using namespace std;
bool be;clock_t startTime;
double getCurrentTime() {
	return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}
const int maxn = 1e6 + 10, mod = 998244353;// mod = 1949777;
const double EPS = 1e-3;
template <typename Type>
void add(Type &x, Type y, Type Md) {
	x += y; while(x >= Md) x -= Md;
	while(x < 0) x += Md;
}
int n, m;
ll a[maxn];
bool ed;
void solve() {
}
ll t[100];
void ins(int x) {
	per_(i, 60, 0) {
		if (x >> i & 1) {
			if (!t[i]) t[i] = x;
			else x ^= t[i]; 
		}
	}
	return;
}
signed main() {
	#ifdef LOCAL
		freopen("w.in", "r", stdin);
//		freopen("w.out", "w", stdout);
		startTime = clock();
//		time_t now_time = time(NULL); tm* TuT = localtime(&now_time); cout << asctime(TuT); cout << "CodeBegin:_______________________" << endl;
//		cout << "Memory footprint:" << ((&be - &ed) >> 20) <<"MB"<< endl;
//		line;
	#endif
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
  //int tt; cin >> tt; while(tt--) solve();
  cin>> n;
  ll s = 0;
  rep_(i,1, n) {
  	cin >> a[i];
  	ins(a[i]);
  	s ^= a[i];
  }
  ll ans = 0;
  ll now = 0;
  rep_(i, 0, 60){
	now ^= t[i];
	if (now == (1LL<<i)-1) ans = max(ans, s ^ (now * 2 + 1));
  }
  cout << ans << endl;
  	#ifdef LOCAL
  	cerr<<"\n\n-----------------------\nProgram done in "<<clock()-startTime<<" ms";
	#endif
 	return 0; 
}
//by whc
// check if over int , and open long long !!!
 
 

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3576kb

input:

4
1 2 1 2

output:

7

result:

ok 1 number(s): "7"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3468kb

input:

5
1 2 3 4 5

output:

14

result:

ok 1 number(s): "14"

Test #3:

score: 0
Accepted
time: 1ms
memory: 3636kb

input:

6
1 2 4 7 15 31

output:

47

result:

ok 1 number(s): "47"

Test #4:

score: -100
Wrong Answer
time: 1ms
memory: 3460kb

input:

5
41 40 50 11 36

output:

0

result:

wrong answer 1st numbers differ - expected: '99', found: '0'