Submission #755107

# Submission time Handle Problem Language Result Execution time Memory
755107 2023-06-09T12:07:11 Z Stickfish Brperm (RMI20_brperm) C++17
13 / 100
3000 ms 1972 KB
#include <bits/stdc++.h>
#include "brperm.h"
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
 
#define fi first
#define se second
#define mp make_pair
 
vector<char> S;
 
void init(int n, const char s[]) {
    for(int i = 0 ; i < n; i ++ ){
        S.push_back(s[i]);
    }
}
 
int query(int i, int k) {
    int sz = (1 << k);
    if(i + sz - 1 >= S.size()) return 0;
    vector<char> A(sz), B(sz);
    for(int j = 0 ; j < sz; j ++ ){
        A[j] = S[i + j];
        int f = 0;
        for(int p = 0; p < k ; p ++ ){
            if((j & (1 << p))){
                f |= (1 << (k - p - 1));
            }
        }
        B[f] = S[i + j];
    }
 
    return (A == B);
}

Compilation message

brperm.cpp: In function 'int query(int, int)':
brperm.cpp:23:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     if(i + sz - 1 >= S.size()) return 0;
      |        ~~~~~~~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Execution timed out 3055 ms 1372 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3022 ms 1972 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Execution timed out 3055 ms 1372 KB Time limit exceeded
4 Halted 0 ms 0 KB -