# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1204035 | MuhammadSaram | Broken Device (JOI17_broken_device) | C++20 | 18 ms | 1344 KiB |
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
void Anna(int n, long long x, int k, int P[])
{
bool off[n]={};
for (int i=0;i<k;i++)
off[P[i]]=1;
int p=59;
for (int i=0;i<n;i++)
{
if (off[i])
Set(i,0);
else
{
Set(i,1);
if (i+1<n && !off[i+1])
Set(i+1,(x>>p)%2),i++,p--;
else if((x>>p)%2==0 && i+1<n)
Set(i+1,0),i++,p--;
}
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
long long Bruno(int n, int a[])
{
int p=59;
long long ans=0;
for (int i=0;i<n;i++)
if (a[i])
ans+=(1ll<<p)*a[i+1],i++,p--;
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |