请求加强数据
查看原帖
请求加强数据
539066
Leo2011楼主2024/1/28 16:07
/*Code by Leo2011*/
#include <bits/stdc++.h>

#define INF 0x3f3f3f3f
#define EPS 1e-8
#define FOR(i, l, r) for (ll(i) = (l); (i) <= (r); ++(i))
#define log printf
#define IOS                      \
	ios::sync_with_stdio(false); \
	cin.tie(nullptr);            \
	cout.tie(nullptr);

using namespace std;

typedef long long ll;

const ll N = 2e5 + 10;
ll n, a[N], mx = -INF;

template <typename T>

inline T read() {
	T sum = 0, fl = 1;
	char ch = getchar();
	for (; !isdigit(ch); ch = getchar())
		if (ch == '-') fl = -1;
	for (; isdigit(ch); ch = getchar()) sum = sum * 10 + ch - '0';
	return sum * fl;
}

template <typename T>

inline void write(T x) {
	static T sta[35];
	int top = 0;
	do {
		sta[top++] = x % 10, x /= 10;
	} while (x);
	while (top) putchar(sta[--top] + 48);
}

int main() {
	n = read<ll>();
	FOR(i, 1, n)
	a[i] = read<ll>();
	FOR(i, 1, n) FOR(j, i + 1, n) mx = max(mx, a[i] & a[j]);
	write<ll>(mx);
	return 0;
}

AC记录

O(n2)O(n ^ 2) 的暴力居然过了?

2024/1/28 16:07
加载中...