답안 #642705

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
642705 2022-09-20T11:56:31 Z TimDee Brperm (RMI20_brperm) C++17
0 / 100
4 ms 1908 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+(1<<k); ++i) {
        int j=0;
        for (int b=k-1; b>=0; --b) {
            j+=(((i-ind)>>b)&1)<<(k-1-b); 
        }
        if ((j+ind>=S.length())) exit(1);
        if (S[i]!=S[j+ind]) return false;
    }
    return true;

}

Compilation message

brperm.cpp: In function 'int query(int, int)':
brperm.cpp:18:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |         if ((j+ind>=S.length())) exit(1);
      |              ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 212 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 212 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 1908 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 212 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -