# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
313129 | YJU | Broken Device (JOI17_broken_device) | C++14 | 54 ms | 3072 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<bits/stdc++.h>
#include"Annalib.h"
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
const ll MOD=1e9+7;
const ll MOD2=998244353;
const ll N=4e5+5;
const ll K=350;
const ld pi=3.14159265359;
const ll INF=(1LL<<40);
#define SQ(i) ((i)*(i))
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define setp setprecision
#define lwb lower_bound
#define SZ(_a) (ll)_a.size()
bool bit(ll k,ll l){
if(k>60)return 0;
return (k>>l)&1;
}
void Anna(int n,ll x,int k,int *p){
bool vis[200];REP(i,200)vis[i]=1;REP(i,k)vis[p[i]]=0;
vector<ll> s[8]={{},{1},{0},{0,0},{1},{0,1},{1,0},{1,1}};
bool ans[200];memset(ans,0,sizeof(ans));
REP(i,200)ans[i]=0;
ll id=0;
for(int i=0;i<n;i+=3){
vector<ll> tmp;
tmp.pb(bit(x,id));tmp.pb(bit(x,id+1));
if(vis[i]+vis[i+1]+vis[i+2]<=1){continue;}
ll f1=-1,f2=-1,mask=(vis[i]*4+vis[i+1]*2+vis[i+2]);
for(int ty=1;ty<8;ty++){
if((mask&ty)!=ty)continue;
if(SZ(s[ty])==1){
if(s[ty][0]==tmp[0])f1=ty;
}else{
if(s[ty]==tmp)f2=ty;
}
}
if(f2!=-1){
id+=2;
REP(j,3)ans[i+j]=bit(f2,2-j);
}else if(f1!=-1){
id+=1;
REP(j,3)ans[i+j]=bit(f1,2-j);
}
}
REP(i,n){
Set(i,ans[i]);
}
}
/*int main(){
ios_base::sync_with_stdio(0);cin.tie(0);
int tp[15],as=15;
REP(i,as)tp[i]=i;
Anna(150,7,as,tp);
return 0;
}*/
#include<bits/stdc++.h>
#include"Brunolib.h"
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
const ll MOD=1e9+7;
const ll MOD2=998244353;
const ll N=4e5+5;
const ll K=350;
const ld pi=3.14159265359;
const ll INF=(1LL<<40);
#define SQ(i) ((i)*(i))
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define setp setprecision
#define lwb lower_bound
#define SZ(_a) (ll)_a.size()
ll Bruno(int n,int *A){
ll ti=0,ans=0;
vector<ll> s[8]={{},{1},{0},{0,0},{1},{0,1},{1,0},{1,1}};
vector<ll> tans;
for(int i=0;i<n;i+=3){
ll mask=A[i]*4+A[i+1]*2+A[i+2];
for(auto j:s[mask])tans.pb(j);
}
REP(i,SZ(tans))if(tans[i])ans+=(1LL<<i);
return ans;
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |