Submission #478268

#TimeUsernameProblemLanguageResultExecution timeMemory
478268stefantagaBrperm (RMI20_brperm)C++14
Compilation error
0 ms0 KiB
#include "brperm.h" #include <cstring> #include <bits/stdc++.h> #define baza 31 #define MOD 1000000007 using namespace std; long long invers[500005][21]; long long hash1[500005][21]; char v[500005]; long long put[25]; void init(int n, const char s[]) { int i,j; put[0]=baza; for (i=1;i<=19;i++) { put[i]=(1LL*put[i-1]*put[i-1])%MOD; } for (i=0;i<n;i++) { invers[i][0]=s[i]-'a'; } for (int i=1;i<=19;i++) { for (j=0;j+(1<<i)-1<n;j++) { invers[j][i]=(invers[j][i-1]+(1LL*invers[j+(1<<(i-1))][i-1]*put[19-i])%MOD)%MOD; } } for (i=0;i<=19;i++) { for (j=n-1;j>=0;j--) { hash1[j][i]=((s[j]-'a')+1LL*hash1[j+1][i]*put[19-i])%MOD; } } } int query(int i, int k) { long long ceau1=(hash1[i][k]-(1LL*hash1[i+(1<<k)][k]*put[19])%MOD+MOD)%MOD; long long ceau2=invers[i][k]; return ceau1==ceau2; } char s[(int)5e5 + 10] = {}; int main() { cin >> s; init(strlen(s), s); int x, y; while (cin >> x >> y) cout << query(x, y) << '\n'; return 0; }

Compilation message (stderr)

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