QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#140624#4810. Add OneWilliamsWA 1ms3580kbC++142.4kb2023-08-16 14:37:162023-08-16 14:37:18

Judging History

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

  • [2023-08-16 14:37:18]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3580kb
  • [2023-08-16 14:37:16]
  • 提交

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'
#define int ll
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) {
	rep_(i, 0, 60) {
		if (x >> i & 1) {
			if (!t[i]) {
				t[i] = x; 
				break;
			}
			else x ^= t[i]; 
		}
	}
	return;
}
unordered_map<ll, ll> mp;
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, 61) mp[(1LL<<i)-1] = (1LL<<i+1)-1;
  rep_(i, 0, 60){
	now ^= t[i];
//	cout << now << ' ';
	if ((now & ((1LL<<i+1)-1)) == (1LL<<i+1)-1) ans = max(ans, s ^ (now * 2 + 1));
//	if(mp[now]) ans = max(ans, s ^ mp[now]);
  }
//  CE
  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 !!!
 

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
1 2 1 2

output:

7

result:

ok 1 number(s): "7"

Test #2:

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

input:

5
1 2 3 4 5

output:

14

result:

ok 1 number(s): "14"

Test #3:

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

input:

6
1 2 4 7 15 31

output:

47

result:

ok 1 number(s): "47"

Test #4:

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

input:

5
41 40 50 11 36

output:

99

result:

ok 1 number(s): "99"

Test #5:

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

input:

6
10 40 60 2 44 47

output:

64

result:

wrong answer 1st numbers differ - expected: '96', found: '64'