QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#790329 | #9541. Expanding Array | SZH# | WA | 1ms | 3788kb | C++17 | 1.0kb | 2024-11-28 10:48:43 | 2024-11-28 10:48:43 |
Judging History
answer
#include<bits/stdc++.h>
#define pa pair<int,int>
#define INF 0x3f3f3f3f
#define inf 0x3f
#define fi first
#define se second
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define pb push_back
using namespace std;
inline ll read()
{
ll f=1,sum=0;char c=getchar();
while (!isdigit(c)) {if (c=='-') f=-1;c=getchar();}
while (isdigit(c)) {sum=sum*10+c-'0';c=getchar();}
return sum*f;
}
const int MAXN=100010;
unordered_set <int> s;
int a[MAXN];
int main()
{
int n=read();
for (int i=1;i<=n;i++)
{
a[i]=read();
unordered_set <int> :: iterator it;
vector <int> need;
for (it=s.begin();it!=s.end();)
{
if ((a[i]&(*it))==(*it)) a[i]^=(*it),it++;
else{
int d=a[i]&*it;
int d2=*it-d;
a[i]-=d;
auto nit=it;
it++;
s.erase(nit);
if (d) need.push_back(d);
if (d2) need.push_back(d2);
}
}
if (a[i]) need.push_back(a[i]);
for (auto v:need) s.insert(v);
}
int num=s.size();
cout<<(1ll<<num)<<endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3788kb
input:
2 2 3
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
2 3 4
output:
4
result:
ok single line: '4'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
2 3 5
output:
8
result:
ok single line: '8'
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3472kb
input:
10 37760128 12721860 37519778 33518004 2760086 4473592 65451644 83416788 44877547 36766460
output:
67108864
result:
wrong answer 1st lines differ - expected: '56', found: '67108864'