Submission #231532

# Submission time Handle Problem Language Result Execution time Memory
231532 2020-05-13T22:04:25 Z cstuart Broken Device (JOI17_broken_device) C++17
73 / 100
55 ms 3328 KB
#include <bits/stdc++.h>
using namespace std;
#include "Annalib.h"
 
void Anna (int N, long long X, int K, int P[]) {
  
  bool     fuc[N+5], init;
  int      pre[N+5], b;
  string   rep[4] = {"100110101001101010101001100110010110100101010110011001011010100101010110011010101010101010100110010101011001100110101001100101100101010101101010100101", "010101101010010110100110101010101010100101010101101001010101010101011010101001011001101010011010011001011001100110010110011010010101010101010110100110", "01001000001000010100001000010100010000010010010000010010001001000100000100010001010001000010100000011000100010000100100010000010001000010100", "01111101110110111011101111101110101110111011111010111011011111100111011111100111011111100111111010111101110111011110011101111011110101111011"};
  
  memset(fuc, 1, sizeof fuc);
  for (int i = 0; i < K; i++) fuc[P[i]] = 0;
  
  for (int s = 0; s < 4; s++) {
    init = 0;
    b = 0;
    for (int i = 0; i < N; i++) {
      if (!fuc[i]) pre[i] = 0;
      else if (!init && i % 4 == s) pre[i] = 1, init = 1;
      else if (!init) pre[i] = 0;
      else if (b == 60) pre[i] = 0;
      else if (((1ll << b) & X) == 0 && rep[s][i % (int)rep[s].length()] == '1') pre[i] = 0;
      else if (((1ll << b) & X) > 0  && rep[s][i % (int)rep[s].length()] == '0') pre[i] = 0;
      else pre[i] = 1, b++;
    }
    if (b == 60) {
      for (int i = 0; i < N; i++) Set(i, pre[i]);
      return;
    }
  }
  
  for (int i = 0; i < N; i++) Set(i, pre[i]);
  
}
#include <bits/stdc++.h>
using namespace std;
#include "Brunolib.h"
 
long long Bruno (int N, int A[]) {
  
  string     rep[4] = {"100110101001101010101001100110010110100101010110011001011010100101010110011010101010101010100110010101011001100110101001100101100101010101101010100101", "010101101010010110100110101010101010100101010101101001010101010101011010101001011001101010011010011001011001100110010110011010010101010101010110100110", "01001000001000010100001000010100010000010010010000010010001001000100000100010001010001000010100000011000100010000100100010000010001000010100", "01111101110110111011101111101110101110111011111010111011011111100111011111100111011111100111111010111101110111011110011101111011110101111011"};
  long long  V = 0;
  int        s = -1;
  int        b = 0;
  
  for (int i = 0; i < N; i++) {
    if (A[i] == 1) {
      if (s == -1) s = i % 4;
      else if (rep[s][i % (int)rep[s].length()] == '1') V += (1ll << b), b++;
      else b++;
    }
  }
  
  return V;
}
# Verdict Execution time Memory Grader output
1 Partially correct 50 ms 3072 KB Output is partially correct - L* = 38
2 Partially correct 47 ms 3072 KB Output is partially correct - L* = 38
3 Partially correct 49 ms 3056 KB Output is partially correct - L* = 37
4 Partially correct 49 ms 3072 KB Output is partially correct - L* = 37
5 Partially correct 48 ms 3056 KB Output is partially correct - L* = 37
6 Partially correct 48 ms 3312 KB Output is partially correct - L* = 37
7 Partially correct 48 ms 3072 KB Output is partially correct - L* = 37
8 Partially correct 48 ms 3072 KB Output is partially correct - L* = 37
9 Partially correct 48 ms 3072 KB Output is partially correct - L* = 37
10 Partially correct 48 ms 3056 KB Output is partially correct - L* = 38
11 Partially correct 48 ms 3056 KB Output is partially correct - L* = 37
12 Partially correct 49 ms 3072 KB Output is partially correct - L* = 37
13 Partially correct 48 ms 3072 KB Output is partially correct - L* = 37
14 Partially correct 47 ms 3072 KB Output is partially correct - L* = 38
15 Partially correct 47 ms 3072 KB Output is partially correct - L* = 38
16 Partially correct 49 ms 3072 KB Output is partially correct - L* = 39
17 Partially correct 50 ms 3072 KB Output is partially correct - L* = 37
18 Partially correct 48 ms 3328 KB Output is partially correct - L* = 31
19 Partially correct 49 ms 3072 KB Output is partially correct - L* = 37
20 Partially correct 48 ms 3072 KB Output is partially correct - L* = 37
21 Partially correct 48 ms 3024 KB Output is partially correct - L* = 38
22 Partially correct 48 ms 3072 KB Output is partially correct - L* = 39
23 Partially correct 46 ms 3072 KB Output is partially correct - L* = 38
24 Partially correct 48 ms 3072 KB Output is partially correct - L* = 38
25 Partially correct 47 ms 3072 KB Output is partially correct - L* = 37
26 Partially correct 47 ms 3072 KB Output is partially correct - L* = 37
27 Partially correct 48 ms 3072 KB Output is partially correct - L* = 32
28 Partially correct 48 ms 3072 KB Output is partially correct - L* = 37
29 Partially correct 50 ms 3072 KB Output is partially correct - L* = 38
30 Partially correct 48 ms 3072 KB Output is partially correct - L* = 37
31 Partially correct 55 ms 3328 KB Output is partially correct - L* = 37
32 Partially correct 49 ms 3056 KB Output is partially correct - L* = 37
33 Partially correct 49 ms 3056 KB Output is partially correct - L* = 38
34 Partially correct 50 ms 3072 KB Output is partially correct - L* = 38
35 Partially correct 48 ms 3056 KB Output is partially correct - L* = 38
36 Partially correct 49 ms 3072 KB Output is partially correct - L* = 37
37 Partially correct 48 ms 3072 KB Output is partially correct - L* = 37
38 Partially correct 48 ms 2816 KB Output is partially correct - L* = 39
39 Partially correct 48 ms 3072 KB Output is partially correct - L* = 31
40 Partially correct 47 ms 3072 KB Output is partially correct - L* = 36