| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 1219982 | gvancak | Broken Device (JOI17_broken_device) | C++20 | 19 ms | 1608 KiB | 
#include "Annalib.h"
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long
using namespace std;
void Anna( int N, long long X, int K, int P[] ){
	ll n=N,a[1500],x;	ll ind1,ind2;
	for (int i=0; i<N; i++) a[i]=0;
	for (int i=0; i<K; i++){
		a[P[i]]=1;
	}
	ll y;
	y=1;
  for( int i = 0; i < N; i+=3 ){
  	x=a[i]+a[i+1]+a[i+2];
  	if (x>=2){
    Set( i, 0 );
    Set( i+1, 0 );
    Set( i+2, 0 ); continue;
	}
	if (x==0){
	
		if ((y&X)==0) ind1=0; else ind1=1;
		y*=2;
		if ((y&X)==0) ind2=0; else ind2=1;
		y*=2;
	//	cout<<i<<" "<<ind1<<" "<<ind2<<endl;
		if (ind1==0 && ind2==0){
			Set( i, 0 );
    		Set( i+1, 1 );
    		Set( i+2, 1 ); continue;
		}
		
		if (ind1==0 && ind2==1){
			Set( i, 0 );
    		Set( i+1, 1 );
    		Set( i+2, 0 ); continue;
		}
		
		if (ind1==1 && ind2==0){
			Set( i, 1 );
    		Set( i+1, 0 );
    		Set( i+2, 1 ); continue;
		}
		
		if (ind1==1 && ind2==1){
			Set( i, 1 );
    		Set( i+1, 1 );
    		Set( i+2, 1 ); continue;
		}
	}
	if (x==1){
		if ((y&X)==0) ind1=0; else ind1=1;
		y*=2;
		if ((y&X)==0) ind2=0; else ind2=1;
		y*=2;
		if (a[i]==1){
			if (ind1==1){
				y/=2;
			Set( i, 0 );
    		Set( i+1, 0 );
    		Set( i+2, 1 ); continue;
			}
		if (ind1==0 && ind2==0){
			Set( i, 0 );
    		Set( i+1, 1 );
    		Set( i+2, 1 ); continue;
			}
		if (ind1==0 && ind2==1){
			Set( i, 0 );
    		Set( i+1, 1 );
    		Set( i+2, 0 ); continue;
			}
		}
		if (a[i+1]==1){
			y/=2;
			if (ind1==1){
			Set( i, 0 );
    		Set( i+1, 0 );
    		Set( i+2, 1 ); continue;
			}
		if (ind1==0 ){
			Set( i, 1 );
    		Set( i+1, 0 );
    		Set( i+2, 0 ); continue;
			}
			
		}
		if (a[i+2]==1){
			
			y/=2;
			if (ind1==1){
			Set( i, 1 );
    		Set( i+1, 1 );
    		Set( i+2, 0 ); continue;
			}
		if (ind1==0 ){
			Set( i, 1 );
    		Set( i+1, 0 );
    		Set( i+2, 0 ); continue;
			}
		}
	}
    
  }
}
#include "Brunolib.h"
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long
using namespace std;
long long Bruno( int N, int A[] ){
  ll a1,a2,a3;
  string s="";
 /* for (int i=0; i<N; i++){
  	cout<<A[i];
  }*/
  //cout<<endl;
  for (int i=0; i<N; i+=3){
  	a1=A[i]; a2=A[i+1]; a3=A[i+2];
  	if (a1==0 && a2==0 && a3==1){
  		s+='1';
	  }
	  if (a1==0 && a2==1 && a3==0){
  		s+='0'; s+='1';
	  }
	  if (a1==0 && a2==1 && a3==1){
  		s+='0'; s+='0';
	  }
	  if (a1==1 && a2==0 && a3==0){
  		s+='0';
	  }
	  if (a1==1 && a2==0 && a3==1){
  		s+='1'; s+='0';
	  }
	  if (a1==1 && a2==1 && a3==0){
  		s+='1';
	  }
	  if (a1==1 && a2==1 && a3==1){
  		s+='1'; s+='1';
	  }
  }
  //reverse(s.begin(),s.end());
  ll z=1,ans=0;
  for (int i=0; i<s.size(); i++){
  	if (s[i]=='1') ans+=z;
	  z*=2; 
  }
  //cout<<ans<<endl;
  return ans;
  
  
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
