답안 #519490

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
519490 2022-01-26T12:23:10 Z Stickfish Brperm (RMI20_brperm) C++17
0 / 100
7 ms 2944 KB
#include "brperm.h"
#include <cassert>
#include <string>
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;

const int MAXN = 500008;
string s;

void init(int n, const char s_[]) {
    for (int i = 0; i < n; ++i)
        s.push_back(s_[i]);
    return;
    //ll raymoo = 1;
    //for (int i = 0; i < n; ++i) {
        //phash[i] = (phash[i - 1] + raymoo * (s[i] - 'a')) % MOD;
        //raymoo = (raymoo * MUL) % MOD;
        //cout << phash[i] << ' ';
    //}
    //cout << endl;
    //return;
}

int query(int l, int k) {
    assert(k < 10 && l + (1 << k) <= s.size());
    vector<int> ps = {0};
    for (int t = 0; t < k; ++t) {
        for (int i = 0; i < (1 << t); ++i)
            ps.push_back(ps[i] + (1 << (k - t - 1)));
    }
    for (int i = 0; i < (1 << k); ++i) {
        if (s[l + i] != s[l + ps[i]])
            return 0;
    }
    return 1;
}

Compilation message

In file included from /usr/include/c++/10/cassert:44,
                 from brperm.cpp:2:
brperm.cpp: In function 'int query(int, int)':
brperm.cpp:27:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |     assert(k < 10 && l + (1 << k) <= s.size());
      |                      ~~~~~~~~~~~~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 452 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 452 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 7 ms 2944 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 452 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -