Submission #443072

# Submission time Handle Problem Language Result Execution time Memory
443072 2021-07-09T15:23:17 Z ltf0501 Bit Shift Registers (IOI21_registers) C++17
34 / 100
2 ms 648 KB
#include "registers.h"
#include <bits/stdc++.h>
using namespace std;

void construct_instructions(int s, int n, int k, int q) {
  vector<bool> v(2000);
  const int min_index = 99, and_index = 98, one_index = 97, max_index = 80;
  v[0] = 1;
  append_store(one_index, v);
  for(int i = 0; i < k; i++) v[i] = 1;
  append_store(and_index, v);

  for(int j = 0; j < n - 1; j++) {
    for(int i = 0; i < n - 1; i++) {
      append_right(min_index, 0, i * k);
      append_and(min_index, and_index, min_index); // a[i] at r[min_index]

      append_right(1, 0, (i + 1) * k); // a[i + 1] at r[1]
      append_and(1, 1, and_index);

      append_xor(2, 1, min_index); // a[i] ^ a[i + 1] at r[2]
      append_not(96, min_index);
      append_add(96, 96, 97);
      append_add(96, 96, 1); // y - x at r[96]
      append_right(96, 96, 1000); // y >= x: all 0, y < x: all 1

      append_and(3, 2, 96);
      append_xor(min_index, 3, min_index); // min(a[i], a[i + 1]) at r[min_index]
      append_xor(max_index, min_index, 2); // max(a[i], a[i + 1]) at r[max_index]

      for(int o = 0; o < 2000; o++) v[o] = 1;
      for(int o = i * k; o < (i + 2) * k; o++) v[o] = 0;
      append_store(50, v);
      //append_print(0);
      //append_print(50);
      append_and(0, 0, 50);
      

      append_left(min_index, min_index, i * k);
      append_left(max_index, max_index, (i + 1) * k);

      append_or(0, 0, min_index);
      append_or(0, 0, max_index);
      //append_print(2);
      //append_print(min_index);
      //append_print(max_index);
      //append_print(0);
    }
  }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 2 ms 648 KB Wrong answer detected in grader
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Wrong answer detected in grader
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 588 KB Output is correct
2 Correct 2 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 588 KB Output is correct
2 Correct 2 ms 460 KB Output is correct
3 Incorrect 2 ms 648 KB Wrong answer detected in grader
4 Halted 0 ms 0 KB -