답안 #858098

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
858098 2023-10-07T12:01:41 Z iulia_morariu Brperm (RMI20_brperm) C++14
0 / 100
3000 ms 2044 KB
#include <bits/stdc++.h>
#include <brperm.h>

using namespace std;
string v;

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

long long int transform(int nr, int k){
    vector <int> b;
    while(nr > 0){
        b.push_back(nr % 2);
        nr /= 2;
    }
    while(b.size() < k) b.push_back(0);

    long long int n1 = 0;
    long long int p = 1;
    for(int j = k - 1; j >= 0; j--){
        n1 += p * b[j];
        p *= 2;
    }
    return n1;
}

int query ( int it , int k ){
    int p = 1;
    for(int i = 0; i < k; i++) p *= 2;
    for(int i = it; i < it + p; i++){
        long long int x = transform( i - it, k );
        //cout << "i = " << i << " x = " << x << endl;
        if( v[x] != v[i] ) return 0;
    }
    return 1;
}

Compilation message

brperm.cpp: In function 'long long int transform(int, int)':
brperm.cpp:17:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   17 |     while(b.size() < k) b.push_back(0);
      |           ~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3051 ms 2044 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -