Submission #1208387

#TimeUsernameProblemLanguageResultExecution timeMemory
1208387mychecksedadBroken Device (JOI17_broken_device)C++20
51 / 100
25 ms1580 KiB
/* Author : Mychecksdead  */
#include<bits/stdc++.h>
#include "Annalib.h"
using namespace std;
#define ll long long int
#define MOD (1000000000+7)
#define MOD1 (998244353)
#define pb push_back
#define all(x) x.begin(), x.end()
#define en cout << '\n'
#define ff first
#define ss second
#define pii pair<int,int>
#define vi vector<int>
const int N = 1e6+100, M = 1e5+10, K = 52, MX = 30;

vi O = {61, 123, 9, 113, 126, 54, 97, 71, 65, 4, 60, 89, 13, 46, 82, 21, 147, 43, 99, 40, 127, 39, 24, 130, 36, 98, 132, 100, 56, 144, 17, 50, 141, 112, 48, 102, 72, 81, 109, 139, 62, 86, 77, 27, 91, 108, 37, 140, 133, 76, 68, 85, 146, 88, 107, 111, 45, 12, 67, 117, 134, 131, 23, 1, 57, 53, 129, 66, 70, 26, 47, 94, 142, 0, 121, 74, 87, 90, 34, 51, 78, 32, 49, 44, 101, 148, 119, 75, 138, 115, 136, 64, 79, 10, 3, 42, 92, 55, 63, 15, 58, 118, 5, 95, 73, 110, 14, 8, 103, 20, 35, 69, 124, 19, 96, 149, 6, 30, 116, 145, 114, 135, 16, 38, 29, 125, 105, 25, 93, 18, 11, 84, 128, 2, 52, 143, 28, 41, 137, 31, 120, 7, 59, 80, 33, 104, 106, 122, 22, 83};
void Anna( int n, long long X, int k, int p[] ){
  vector<bool> good(n, 1);
  for(int i = 0; i < k; ++i) good[p[i]] = 0;
  for(int i = 2; i < n; i += 3){
    if(good[O[i - 2]] && good[O[i - 1]] && good[O[i]]){
      Set(O[i], 1);
    }else{
      Set(O[i], 0);
    }
  }

  for(int i = 0; i < n; i += 3){
    // we'll set i, i+1
    if(good[O[i]] && good[O[i + 1]] && good[O[i + 2]]){
      Set(O[i], X % 2);
      X /= 2;
      Set(O[i + 1], X % 2);
      X /= 2;
    }else{
      Set(O[i], 0);
      Set(O[i + 1], 0);
    }
  }
}
#include<bits/stdc++.h>
#include "Brunolib.h"
using namespace std;
#define ll long long int
#define MOD (1000000000+7)
#define MOD1 (998244353)
#define pb push_back
#define all(x) x.begin(), x.end()
#define en cout << '\n'
#define ff first
#define ss second
#define pii pair<int,int>
#define vi vector<int>
const int N = 1e6+100, M = 1e5+10, K = 52, MX = 30;
vi OO = {61, 123, 9, 113, 126, 54, 97, 71, 65, 4, 60, 89, 13, 46, 82, 21, 147, 43, 99, 40, 127, 39, 24, 130, 36, 98, 132, 100, 56, 144, 17, 50, 141, 112, 48, 102, 72, 81, 109, 139, 62, 86, 77, 27, 91, 108, 37, 140, 133, 76, 68, 85, 146, 88, 107, 111, 45, 12, 67, 117, 134, 131, 23, 1, 57, 53, 129, 66, 70, 26, 47, 94, 142, 0, 121, 74, 87, 90, 34, 51, 78, 32, 49, 44, 101, 148, 119, 75, 138, 115, 136, 64, 79, 10, 3, 42, 92, 55, 63, 15, 58, 118, 5, 95, 73, 110, 14, 8, 103, 20, 35, 69, 124, 19, 96, 149, 6, 30, 116, 145, 114, 135, 16, 38, 29, 125, 105, 25, 93, 18, 11, 84, 128, 2, 52, 143, 28, 41, 137, 31, 120, 7, 59, 80, 33, 104, 106, 122, 22, 83};

long long Bruno( int n, int a[] ){
  ll ans = 0;
  vi v;
  for(int i = 2; i < n; i += 3){
    if(a[OO[i]]){
      v.pb(a[OO[i - 2]]);
      v.pb(a[OO[i - 1]]);
    }
  }
  reverse(all(v));
  for(int b: v){
    ans *= 2;
    ans += b;
  }

  return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...