QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#790322 | #9541. Expanding Array | SZH# | WA | 0ms | 3608kb | C++17 | 1.0kb | 2024-11-28 10:35:41 | 2024-11-28 10:35:41 |
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: 0ms
memory: 3608kb
input:
2 2 3
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3484kb
input:
2 3 4
output:
4
result:
ok single line: '4'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3604kb
input:
2 3 5
output:
4
result:
wrong answer 1st lines differ - expected: '8', found: '4'