# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1204027 | MuhammadSaram | Broken Device (JOI17_broken_device) | C++20 | 19 ms | 1564 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;
for (int i=0;i<n;i++)
if (!off[i] && !off[i+1] && !off[i+2] && i+2<n && x)
Set(i,1),Set(i+1,x%4/2),Set(i+2,x%2),x/=4,i+=2;
else
Set(i,0);
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
long long Bruno(int n, int a[])
{
long long ans=0;
vector<int> v;
for (int i=0;i<n;i++)
if (a[i])
v.push_back(a[i+1]*2+a[i+2]),i+=2;
while (!v.empty())
ans=ans*4+v.back(),v.pop_back();
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |