# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
959197 | De3b0o | Broken Device (JOI17_broken_device) | C++14 | 43 ms | 3024 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "Annalib.h"
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define in insert
#define pb push_back
#define ppb pop_back()
#define d3 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define cans cout << ans << "\n";
#define yes cout << "Yes" << "\n";
#define no cout << "No" << "\n";
#define pll pair<ll,ll>
#define lin cout << "\n";
#define sqr 340
#define mod 1000000007
#define mid ((l+r)/2)
#define lc (2*n)
#define rc (2*n+1)
using namespace std;
void Anna(int N, long long X, int K, int P[])
{
ll p = 0;
ll b = 1;
map<ll,bool> mp;
for(int i = 0 ; K>i ; i++)
mp[P[i]]=1;
for(int i = 0 ; 150>i ; i+=3)
{
ll c=mp[i]+mp[i+1]+mp[i+2];
if(c>=2)
{
Set(i,0);
Set(i+1,0);
Set(i+2,0);
continue;
}
if(c==0)
{
if((b&X)&&((b*2)&X))
{
Set(i,1);
Set(i+1,0);
Set(i+2,0);
}
else if(b&X)
{
Set(i,1);
Set(i+1,0);
Set(i+2,1);
}
else if((b*2)&X)
{
Set(i,0);
Set(i+1,1);
Set(i+2,1);
}
else
{
Set(i,1);
Set(i+1,1);
Set(i+2,1);
}
b*=4;
}
else if(c==1)
{
if(b&X)
{
if(mp[i+1])
{
b*=2;
if(b&X)
{
Set(i,1);
Set(i+1,0);
Set(i+2,0);
}
else
{
Set(i,1);
Set(i+1,0);
Set(i+2,1);
}
}
else
{
Set(i,0);
Set(i+1,1);
Set(i+2,0);
}
}
else
{
if(mp[i+2])
{
Set(i,1);
Set(i+1,1);
Set(i+2,0);
}
else
{
Set(i,0);
Set(i+1,0);
Set(i+2,1);
}
}
b*=2;
}
}
}
#include "Brunolib.h"
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define in insert
#define pb push_back
#define ppb pop_back()
#define d3 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define cans cout << ans << "\n";
#define yes cout << "Yes" << "\n";
#define no cout << "No" << "\n";
#define pll pair<ll,ll>
#define lin cout << "\n";
#define sqr 340
#define mod 1000000007
#define mid ((l+r)/2)
#define lc (2*n)
#define rc (2*n+1)
using namespace std;
long long Bruno( int N, int A[] )
{
ll b = 1;
ll ans = 0;
for(int i = 0 ; 150>i ; i+=3)
{
ll c = 4*A[i]+2*A[i+1]+A[i+2];
if(c==0)
continue;
if(c==1)
b*=2;
else if(c==2)
{
ans+=b;
b*=2;
}
else if(c==3)
{
b*=2;
ans+=b;
b*=2;
}
else if(c==4)
{
ans+=b;
b*=2;
ans+=b;
b*=2;
}
else if(c==5)
{
ans+=b;
b*=4;
}
else if(c==6)
b*=2;
else if(c==7)
b*=4;
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |