답안 #645763

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
645763 2022-09-28T00:10:41 Z rodov Brperm (RMI20_brperm) C++14
50 / 100
3000 ms 5460 KB
using namespace std;
#include <bits/stdc++.h>
#define  ll long long

//string s;
ll mas[500007];
ll N;
void init(int n, const char s[]) {
    N=n;
    for(int i=0;i<N;i++){
        mas[i]=s[i]-'a'+1;
        //cout<<mas[i]<<' ';
    }
  return;
}
string bin;
ll a1,a2;
ll f(ll v,ll k){
    bin="";
    for(int i=1;i<=k;i++){
        if(v%2==0){
            bin+='0';
        }else{
            bin+='1';
        }
        v/=2;
    }
    reverse(bin.begin(),bin.end());
    a1=1;a2=0;
    for(int i=1;i<=k;i++){
        if(bin[i-1]=='0'){
            a1*=2;
        }else{
            a2+=a1;
            a1+=a1;
        }
    }

    return a2;
}

int query(int i, int k) {
    if(i+(pow(2,k))>N)return 0;

    for(int j=i;j<=i+pow(2,k)-1;j++){
        //cout<<f(j-i,k)<<' '<<j<<endl;
        if(mas[i+f(j-i,k)]!=mas[j])return 0;
    }

  return 1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Correct 51 ms 2240 KB Output is correct
4 Correct 52 ms 2232 KB Output is correct
5 Correct 45 ms 2188 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3042 ms 5460 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Correct 51 ms 2240 KB Output is correct
4 Correct 52 ms 2232 KB Output is correct
5 Correct 45 ms 2188 KB Output is correct
6 Execution timed out 3042 ms 5460 KB Time limit exceeded
7 Halted 0 ms 0 KB -