Submission #645947

# Submission time Handle Problem Language Result Execution time Memory
645947 2022-09-28T10:30:53 Z Vanilla Brperm (RMI20_brperm) C++17
0 / 100
5 ms 2704 KB
#include <bits/stdc++.h>
#include "brperm.h"
using namespace std;
int n;
string s = "";

void init(int N, const char S[]) {
  n = N;
  for (int i = 0; i < n; i++){
    s.push_back(S[i]);
  }
  return;
}

int rev (int x, int k) {
  int b = 0;
  for (int i = 0; i < k; i++){
    if ((1 << (k - i - 1)) & x) b+=(1 << i);
  }
  return b;
}

int query(int l, int k) {
  string s1 = "", s2 = "";
  assert(l + (1 << k) - 1 < n);
  for (int i = l; i <= l + (1 << k) - 1; i++){
    assert(rev(i - l, k) + l < n);
    s1.push_back(s[i]);
    s2.push_back(s[rev(i - l, k) + l]);
  }
  // cout << s1 << "\n" << s2 << "\n";
  return s1 == s2;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 2704 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -