Submission #645986

# Submission time Handle Problem Language Result Execution time Memory
645986 2022-09-28T11:35:40 Z Vanilla Brperm (RMI20_brperm) C++17
13 / 100
3000 ms 2536 KB
#include <bits/stdc++.h>
#include "brperm.h"
using namespace std;
int n;
string s = "";
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;
}

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


int query(int l, int k) {
  if (l + (1 << k) > n) return 0;
  string s1 = "", s2 = "";
  for (int i = l; i <= l + (1 << k) - 1; i++){
    s1.push_back(s[i]);
    s2.push_back(s[rev(i - l, k) + l]);
  }
  return s1 == s2;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Execution timed out 3060 ms 1616 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3075 ms 2536 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Execution timed out 3060 ms 1616 KB Time limit exceeded
4 Halted 0 ms 0 KB -