답안 #645767

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
645767 2022-09-28T00:14:19 Z rodov Brperm (RMI20_brperm) C++14
13 / 100
2 ms 1364 KB
#include "brperm.h"
/////////

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll DIM = 1E3+7;
ll A[DIM],nn;
ll gi(char ch){
    return (ch-'a'+1);
}
void init(int n, const char s[]) {
    nn = n;
    for(ll i = 1;i<=n;++i){
        A[i] = gi(s[i-1]);
    }
    return;
}

int query(int i, int k) {
    ll l = i+1,r = i+(1ll<<k);
    if (r>nn || l<0)return 0;
    for(ll i = l;i<=r;++i){
        vector<ll> bit;
        ll x = i-l;
        for(ll j = 1;j<=k;++j){
            bit.push_back(x&1);
            x/=2;
        }
        //reverse(bit.begin(),bit.end());
        x = 0;
        for(ll to:bit){
            x*=2;
            x+=to;
        }
        if (A[x+l]!=A[i])return 0;
    }

    return 1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Runtime error 1 ms 1364 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 1364 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Runtime error 1 ms 1364 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -