Submission #926192

# Submission time Handle Problem Language Result Execution time Memory
926192 2024-02-12T17:03:53 Z amirhoseinfar1385 Broken Device (JOI17_broken_device) C++17
100 / 100
30 ms 2872 KB
#include "Annalib.h"
#include<bits/stdc++.h>
using namespace std;

void Anna( int N, long long x, int k, int p[] ){
  vector<int>wtf(150);
  for(int i=0;i<k;i++){
  	wtf[p[i]]=1;
  }
  for(int i=0;i<N;i+=3){
  	if(wtf[i]+wtf[i+1]+wtf[i+2]>=2){
  		Set(i,0);
  		Set(i+1,0);
  		Set(i+2,0);
  		continue;
  	}
  	if(wtf[i]+wtf[i+1]+wtf[i+2]==0){
  		long long res=0;
  		res=(x&1);
  		x>>=1;
  		res+=((x&1)<<1);
  		x>>=1;
  		if(res==0){
  			Set(i,0);
  			Set(i+1,1);
  			Set(i+2,1);
  		}else if(res==1){
  			Set(i,1);
  			Set(i+1,0);
  			Set(i+2,0);
  		}else if(res==2){
  			Set(i,1);
  			Set(i+1,1);
  			Set(i+2,1);
  		}else{
  			Set(i,1);
  			Set(i+1,1);
  			Set(i+2,0);
  		}
  		continue;
  	}
  	if(x&1){
  		if(wtf[i+2]==0){
  			Set(i,0);
  			Set(i+1,0);
  			Set(i+2,1);
  			x>>=1;
  		}
  		else{
  			x>>=1;
  			if(x&1){
  				Set(i,1);
  				Set(i+1,1);
  				Set(i+2,0);
  			}
  			else{
  				Set(i,1);
  				Set(i+1,0);
  				Set(i+2,0);
  			}
  			x>>=1;
  		}
  	}
  	else{
  		if(wtf[i+1]==1){
  			Set(i,1);
  			Set(i+1,0);
  			Set(i+2,1);
  		}
  		else{
  			Set(i,0);
  			Set(i+1,1);
  			Set(i+2,0);
  		}
  		x>>=1;
  	}
  }
}
#include "Brunolib.h"
#include<bits/stdc++.h>
using namespace std;

long long Bruno( int N, int A[] ){
  long long res=0;
  vector<long long>all(150);
  for(int i=0;i<N;i++){
   // cout<<i<<" "<<A[i]<<endl;
    all[i]=A[i];
  }
  long long now=0;
  for(int i=0;i<N;i+=3){
    long long fake=all[i+2]+all[i+1]*2+all[i]*4;
   // cout<<"magemishe: "<<fake<<endl;
    if(fake==0){
      continue;
    }
    if(fake==1){
      res+=(1ll<<now);
      now++;
    }
    if(fake==2){
      now++;
    }
    if(fake==3){
      now+=2;
      continue;
    }
    if(fake==4){
      res+=(1ll<<now);
      now+=2;
    }
    if(fake==5){
      now++;
    }
    if(fake==6){
      res+=(1ll<<now)*3;
      now+=2;
    }
    if(fake==7){
      res+=(1ll<<now)*2;
      now+=2;
    }
  }
//  cout<<"wtf: "<<res<<endl;
  return res;
}
# Verdict Execution time Memory Grader output
1 Correct 26 ms 2480 KB Output is correct - L* = 40
2 Correct 25 ms 2396 KB Output is correct - L* = 40
3 Correct 25 ms 2372 KB Output is correct - L* = 40
4 Correct 25 ms 2400 KB Output is correct - L* = 40
5 Correct 26 ms 2872 KB Output is correct - L* = 40
6 Correct 30 ms 2392 KB Output is correct - L* = 40
7 Correct 25 ms 2316 KB Output is correct - L* = 40
8 Correct 27 ms 2400 KB Output is correct - L* = 40
9 Correct 26 ms 2400 KB Output is correct - L* = 40
10 Correct 25 ms 2396 KB Output is correct - L* = 40
11 Correct 27 ms 2620 KB Output is correct - L* = 40
12 Correct 28 ms 2372 KB Output is correct - L* = 40
13 Correct 24 ms 2396 KB Output is correct - L* = 40
14 Correct 25 ms 2396 KB Output is correct - L* = 40
15 Correct 25 ms 2396 KB Output is correct - L* = 40
16 Correct 24 ms 2396 KB Output is correct - L* = 40
17 Correct 27 ms 2812 KB Output is correct - L* = 40
18 Correct 24 ms 2372 KB Output is correct - L* = 40
19 Correct 24 ms 2392 KB Output is correct - L* = 40
20 Correct 30 ms 2396 KB Output is correct - L* = 40
21 Correct 25 ms 2396 KB Output is correct - L* = 40
22 Correct 25 ms 2388 KB Output is correct - L* = 40
23 Correct 25 ms 2396 KB Output is correct - L* = 40
24 Correct 24 ms 2396 KB Output is correct - L* = 40
25 Correct 24 ms 2396 KB Output is correct - L* = 40
26 Correct 24 ms 2404 KB Output is correct - L* = 40
27 Correct 25 ms 2496 KB Output is correct - L* = 40
28 Correct 24 ms 2396 KB Output is correct - L* = 40
29 Correct 24 ms 2396 KB Output is correct - L* = 40
30 Correct 25 ms 2408 KB Output is correct - L* = 40
31 Correct 25 ms 2404 KB Output is correct - L* = 40
32 Correct 25 ms 2404 KB Output is correct - L* = 40
33 Correct 25 ms 2396 KB Output is correct - L* = 40
34 Correct 25 ms 2404 KB Output is correct - L* = 40
35 Correct 25 ms 2384 KB Output is correct - L* = 40
36 Correct 25 ms 2396 KB Output is correct - L* = 40
37 Correct 25 ms 2652 KB Output is correct - L* = 40
38 Correct 25 ms 2392 KB Output is correct - L* = 40
39 Correct 28 ms 2708 KB Output is correct - L* = 40
40 Correct 25 ms 2396 KB Output is correct - L* = 40