Submission #642666

# Submission time Handle Problem Language Result Execution time Memory
642666 2022-09-20T10:34:04 Z TimDee Brperm (RMI20_brperm) C++17
Compilation error
0 ms 0 KB
#include <cstring>
#include <iostream>

char s[(int)5e5 + 10] = {};

//#include "brperm.h"
#include <bits/stdc++.h>
using namespace std;

string S;
void init(int n, const char s[]) {
    S=s;
}

int query(int ind, int 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 (S[i]!=S[ind+j]) return 0;
    }
    return 1;

}

int main() {
    cin >> s;
    init(strlen(s), s);

    int x, y;
    while (cin >> x >> y)
        cout << query(x, y) << '\n';

    return 0;
}

Compilation message

/usr/bin/ld: /tmp/ccUvDJCf.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc7nL5Ne.o:brperm.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccUvDJCf.o:(.bss+0x0): multiple definition of `s'; /tmp/cc7nL5Ne.o:(.bss+0x20): first defined here
collect2: error: ld returned 1 exit status