답안 #924198

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
924198 2024-02-08T16:08:35 Z Camillus Brperm (RMI20_brperm) C++17
0 / 100
2 ms 2392 KB
#include "bits/stdc++.h"
#define debug(...) 42
using namespace std;

#ifndef LOCAL
#include "brperm.h"
#else
void init(int n, const char s[]);
int query(int i, int k);
#endif

string s;

void init(int N, const char S[]) {
    s = string(S, S + N);
}

int swapped(int i, int k) {
    int a = 1;
    int b = 1 << (k - 1);

    if (bool(i & a) == bool(i & b)) {
        return i;
    } else {
        i ^= a;
        i ^= b;
        return i;
    }
}

int query(int i, int k) {
    for (int j = 0; j < (1 << k); j++) {
        if (swapped(j, k) >= (1 << k)) {
            while(true) {}
        }
        if (s[i + j] != s[i + swapped(j, k)]) {
            return false;
        }
    }
    return true;
}

#ifdef LOCAL
char __s[(int)5e5 + 10] = {};

int main() {
    cin >> __s;
    init(strlen(__s), __s);

    int __x, __y;
    while (cin >> __x >> __y)
        cout << query(__x, __y) << '\n';

    return 0;
}
#endif
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 2392 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -