답안 #645991

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
645991 2022-09-28T12:01:24 Z Vanilla Brperm (RMI20_brperm) C++17
50 / 100
3000 ms 2216 KB
#include <bits/stdc++.h>
#include "brperm.h"
using namespace std;
const int maxn = 1e5 + 2;
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;
  bool f = 1;
  for (int i = l; i <= l + (1 << k) - 1; i++){
    if (s[i] != s[rev(i - l, k) + l]) return 0;
  }
  return 1;
}

Compilation message

brperm.cpp: In function 'int query(int, int)':
brperm.cpp:27:8: warning: unused variable 'f' [-Wunused-variable]
   27 |   bool f = 1;
      |        ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 28 ms 1192 KB Output is correct
4 Correct 27 ms 1616 KB Output is correct
5 Correct 31 ms 1712 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3049 ms 2216 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 28 ms 1192 KB Output is correct
4 Correct 27 ms 1616 KB Output is correct
5 Correct 31 ms 1712 KB Output is correct
6 Execution timed out 3049 ms 2216 KB Time limit exceeded
7 Halted 0 ms 0 KB -