답안 #596725

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
596725 2022-07-15T02:14:40 Z definitelynotmee Brperm (RMI20_brperm) C++17
0 / 100
2 ms 2388 KB
#include "brperm.h"
#include<bits/stdc++.h>
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T>
using matrix = vector<vector<T>>;
const ll INFL = 1ll<<60;
const int MOD = 1e9+7;

string S;

void init(int n, const char s[]) {

    S = string(s,s+n);
    return;
}

int getreverse(int x, int k){
    int ret = 0;
    for(int i = 0; i < k; i++){
        ret+=(1<<i)*bool((1<<(k-i-1))&x);
    }
    return ret;
}

int query(int start, int k) {

    if(k == 0)
        return 1;

    bool ok = 1;

    for(int i = 0; i < (1<<k); i++){
        //cout << k << ": " <<  bitset<4>(i-start) << ' ' << bitset<4>(getreverse(i-start,k)) << '\n';
        assert(getreverse(i,k)+start < S.size());
        ok&=S[getreverse(i,k)+start] == S[i+start];
    }

    return ok;
}

Compilation message

In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from brperm.cpp:2:
brperm.cpp: In function 'int query(int, int)':
brperm.cpp:40:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |         assert(getreverse(i,k)+start < S.size());
      |                ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 2388 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -