Submission #313132

# Submission time Handle Problem Language Result Execution time Memory
313132 2020-10-15T08:28:03 Z YJU Broken Device (JOI17_broken_device) C++14
100 / 100
53 ms 3328 KB
#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(l>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},{1,0},{0,0},{0,1},{1},{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},{1,0},{0,0},{0,1},{1},{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

Bruno.cpp: In function 'll Bruno(int, int*)':
Bruno.cpp:28:5: warning: unused variable 'ti' [-Wunused-variable]
   28 |  ll ti=0,ans=0;
      |     ^~
# Verdict Execution time Memory Grader output
1 Correct 50 ms 3064 KB Output is correct - L* = 40
2 Correct 50 ms 3072 KB Output is correct - L* = 40
3 Correct 49 ms 3056 KB Output is correct - L* = 40
4 Correct 51 ms 3072 KB Output is correct - L* = 40
5 Correct 49 ms 3056 KB Output is correct - L* = 40
6 Correct 50 ms 3072 KB Output is correct - L* = 40
7 Correct 49 ms 3064 KB Output is correct - L* = 40
8 Correct 51 ms 3072 KB Output is correct - L* = 40
9 Correct 50 ms 3056 KB Output is correct - L* = 40
10 Correct 49 ms 3072 KB Output is correct - L* = 40
11 Correct 50 ms 3056 KB Output is correct - L* = 40
12 Correct 50 ms 3072 KB Output is correct - L* = 40
13 Correct 50 ms 3072 KB Output is correct - L* = 40
14 Correct 52 ms 3072 KB Output is correct - L* = 40
15 Correct 49 ms 3056 KB Output is correct - L* = 40
16 Correct 53 ms 3056 KB Output is correct - L* = 40
17 Correct 51 ms 3072 KB Output is correct - L* = 40
18 Correct 50 ms 3064 KB Output is correct - L* = 40
19 Correct 50 ms 3056 KB Output is correct - L* = 40
20 Correct 49 ms 3056 KB Output is correct - L* = 40
21 Correct 51 ms 3056 KB Output is correct - L* = 40
22 Correct 50 ms 3056 KB Output is correct - L* = 40
23 Correct 51 ms 3072 KB Output is correct - L* = 40
24 Correct 50 ms 3072 KB Output is correct - L* = 40
25 Correct 50 ms 3136 KB Output is correct - L* = 40
26 Correct 50 ms 3064 KB Output is correct - L* = 40
27 Correct 49 ms 3056 KB Output is correct - L* = 40
28 Correct 50 ms 3056 KB Output is correct - L* = 40
29 Correct 51 ms 3056 KB Output is correct - L* = 40
30 Correct 49 ms 3056 KB Output is correct - L* = 40
31 Correct 49 ms 3056 KB Output is correct - L* = 40
32 Correct 49 ms 3056 KB Output is correct - L* = 40
33 Correct 49 ms 3056 KB Output is correct - L* = 40
34 Correct 51 ms 3072 KB Output is correct - L* = 40
35 Correct 49 ms 3328 KB Output is correct - L* = 40
36 Correct 50 ms 3072 KB Output is correct - L* = 40
37 Correct 49 ms 3056 KB Output is correct - L* = 40
38 Correct 49 ms 3056 KB Output is correct - L* = 40
39 Correct 51 ms 3328 KB Output is correct - L* = 40
40 Correct 49 ms 3072 KB Output is correct - L* = 40