QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#883722 | #10008. Isn't It Beautiful? | bulijiojiodibuliduo# | RE | 1ms | 3840kb | C++17 | 1.1kb | 2025-02-05 18:25:59 | 2025-02-05 18:25:59 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef basic_string<int> BI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}());
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head
const int N=201000;
int n,a[N],vis[N];
void solve() {
scanf("%d",&n);
rep(i,1,n+1) scanf("%d",&a[i]);
int pos=-1,ans=-1;;
for (int b=0;b<30;b++) {
int x=(1<<b)-1;
rep(i,0,n+2) vis[i]=0;
rep(i,1,n+1) vis[a[i]&x]=1;
int mx=0;
while (vis[mx]) mx++;
if (mx>ans) ans=mx,pos=x;
}
printf("%d\n",pos);
fprintf(stderr,"%d\n",ans);
}
int _;
int main() {
for (scanf("%d",&_);_;_--) {
solve();
}
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3840kb
input:
1 6 13 11 40 10 33 19
output:
3
result:
ok ok (1 test case)
Test #2:
score: -100
Runtime Error
input:
2240 61 504480583 220800155 565433298 371420012 825404978 523350662 450499933 369837413 415696969 560458948 710074240 248371716 502655880 510976986 941211285 493852175 673325427 606545283 555763764 848271246 729412332 630271332 470220824 778390746 264427786 229531301 267674352 437129089 513679682 10...