Submission #556916

# Submission time Handle Problem Language Result Execution time Memory
556916 2022-05-04T11:10:46 Z cadmiumsky Broken Device (JOI17_broken_device) C++14
0 / 100
1 ms 500 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
deque<int> bits;
const int nmax = 125;
int occ[nmax];
vector<int> toset; //two
void myset(int val) { toset.push_back(val); }

void calc(int poz) {  
  int coef = (occ[poz] << 2) | (occ[poz + 1] << 1) | (occ[poz]);
  if(__builtin_popcount(coef) >= 2) {
    myset(0);
    myset(0);
    myset(0);
    return;
  }
  switch(coef) {
    case 0b001: {
      if(bits[0] == 0) {
        if(bits[1] == 0) // 0
          myset(1),
          myset(0),
          myset(0);
        else // 01
          myset(1),
          myset(1),
          myset(0),
          bits.pop_front();
      }
      else // 1
        myset(0),
        myset(1),
        myset(0);
      break;
    }
    case 0b010: {
      if(bits[0] == 0) // 0
        myset(1),
        myset(0),
        myset(0);
      else {
        if(bits[1] == 0) // 10
          myset(0),
          myset(0),
          myset(1);
        else            // 11
          myset(1),
          myset(0),
          myset(1);
        bits.pop_front();
      }
      break;
    }
    case 0b100: {
      if(bits[0] == 0) // 0
        myset(0),
        myset(1),
        myset(1);
      else            // 1
        myset(1),
        myset(0),
        myset(1);
      break;
    }
    case 0b000: {
      int u = (bits[0] << 1) | bits[1];
      switch(u) {
        case 0b00:
          myset(1),
          myset(1),
          myset(1);
          break;
        case 0b01:
          myset(1),
          myset(1),
          myset(0);
          break;
        case 0b10:
          myset(0),
          myset(0),
          myset(1);
          break;
        case 0b11:
          myset(1),
          myset(0),
          myset(1);
          break;
      }
      bits.pop_front();
    }
  }
  bits.pop_front();
}

void Anna( int n, long long x, int k, int p[] ){
  for(int i = 59; i >= 0; i--)
    bits.push_back((x & (1LL << i)) > 0LL);
  for(int i = 0; i <= 300; i++)
    bits.push_back(0);
  for(int i = 0; i < k; i++)
    occ[p[i]] = 1;
  for(int i = 0; i < n; i += 3)
    calc(i);
  for(int i = 0; i < n; i++)
    Set(i, toset[i]);
  return;
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;

string rez;
void myset(string s) { rez += s;}
vector<int> a;
void calcB(int poz) {
  int coef = (a[poz] << 2) | (a[poz + 1] << 1) | a[poz];
  switch(coef) {
    case 0b111: 
      myset("00");
      break;
    case 0b110:
      myset("01");
      break;
    case 0b101:
      myset("11");
      break;
    case 0b011:
      myset("0");
      break;
    case 0b001:
      myset("10");
      break;
    case 0b010:
      myset("1");
      break;
    case 0b100:
      myset("0");
      break;
    case 0b000:
      break;
  }
  return;
}

long long Bruno( int N, int A[] ){
  for(int i = 0; i < N; i++)
    a.push_back(A[i]);
  for(int i = 0; i < N; i += 3)
    calcB(i);
  return 0LL;
  long long X = 0;
  for(int i = 0; i < 60; i++)
    X = (X << 1) + (long long)(rez[i] - '0');
  return X;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 500 KB Execution killed with signal 11
2 Runtime error 1 ms 468 KB Execution killed with signal 11
3 Runtime error 1 ms 444 KB Execution killed with signal 11
4 Runtime error 1 ms 468 KB Execution killed with signal 11
5 Runtime error 1 ms 448 KB Execution killed with signal 11
6 Runtime error 1 ms 468 KB Execution killed with signal 11
7 Runtime error 1 ms 468 KB Execution killed with signal 11
8 Runtime error 1 ms 468 KB Execution killed with signal 11
9 Runtime error 1 ms 468 KB Execution killed with signal 11
10 Runtime error 1 ms 468 KB Execution killed with signal 11
11 Runtime error 1 ms 448 KB Execution killed with signal 11
12 Runtime error 1 ms 468 KB Execution killed with signal 11
13 Runtime error 1 ms 468 KB Execution killed with signal 11
14 Runtime error 1 ms 468 KB Execution killed with signal 11
15 Runtime error 1 ms 468 KB Execution killed with signal 11
16 Runtime error 1 ms 444 KB Execution killed with signal 11
17 Runtime error 1 ms 468 KB Execution killed with signal 11
18 Runtime error 1 ms 444 KB Execution killed with signal 11
19 Runtime error 1 ms 468 KB Execution killed with signal 11
20 Runtime error 1 ms 480 KB Execution killed with signal 11
21 Runtime error 1 ms 468 KB Execution killed with signal 11
22 Runtime error 1 ms 468 KB Execution killed with signal 11
23 Runtime error 1 ms 468 KB Execution killed with signal 11
24 Runtime error 1 ms 468 KB Execution killed with signal 11
25 Runtime error 1 ms 448 KB Execution killed with signal 11
26 Runtime error 1 ms 468 KB Execution killed with signal 6
27 Runtime error 1 ms 468 KB Execution killed with signal 11
28 Runtime error 1 ms 468 KB Execution killed with signal 11
29 Runtime error 1 ms 468 KB Execution killed with signal 11
30 Runtime error 1 ms 468 KB Execution killed with signal 11
31 Runtime error 1 ms 468 KB Execution killed with signal 11
32 Runtime error 1 ms 468 KB Execution killed with signal 11
33 Runtime error 1 ms 448 KB Execution killed with signal 11
34 Runtime error 1 ms 468 KB Execution killed with signal 11
35 Runtime error 1 ms 468 KB Execution killed with signal 11
36 Runtime error 1 ms 444 KB Execution killed with signal 11
37 Runtime error 1 ms 452 KB Execution killed with signal 11
38 Runtime error 1 ms 444 KB Execution killed with signal 11
39 Runtime error 1 ms 468 KB Execution killed with signal 11
40 Runtime error 1 ms 468 KB Execution killed with signal 11