Submission #642727

# Submission time Handle Problem Language Result Execution time Memory
642727 2022-09-20T12:17:07 Z TimDee Brperm (RMI20_brperm) C++17
0 / 100
124 ms 6512 KB
#include "brperm.h"
#include <bits/stdc++.h>
using namespace std;

string S;
void init(int n, const char s[]) {
    for (int i=0; i<n; ++i) S.push_back(s[i]);
}

int query(int ind, int k) {

    //++k;
    for (int i=ind; i<ind+(1ll<<k); ++i) {
        int j=0;
        for (int b=0; b<k; ++b) {
            j+=(((i-ind)>>b)&1)<<(k-1-b); 
        }
        //cout<<i<<' '<<j<<'\n';
        if ((j+ind>=S.length()) || (i>>S.length())) return 0;
        if (S[i]!=S[j+ind]) return false;
    }
    return true;

}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rand(int a, int b) {
    return a+(rng()%(b-a+1));
}

Compilation message

brperm.cpp: In function 'int query(int, int)':
brperm.cpp:19:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |         if ((j+ind>=S.length()) || (i>>S.length())) return 0;
      |              ~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 124 ms 6512 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -