QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#746722#9747. 字符串复制ezteam1#Compile Error//C++203.0kb2024-11-14 15:22:372024-11-14 15:22:37

Details

answer.code:25:33: error: ‘int link [2005000]’ redeclared as different kind of entity
   25 | int ch[kN][26], len[kN], link[kN], last, nc;
      |                                 ^
In file included from /usr/include/c++/13/bits/atomic_wait.h:44,
                 from /usr/include/c++/13/bits/atomic_base.h:42,
                 from /usr/include/c++/13/bits/shared_ptr_atomic.h:33,
                 from /usr/include/c++/13/memory:81,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:56,
                 from answer.code:1:
/usr/include/unistd.h:789:12: note: previous declaration ‘int link(const char*, const char*)’
  789 | extern int link (const char *__from, const char *__to)
      |            ^~~~
answer.code: In function ‘void extend(char)’:
answer.code:28:69: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   28 |     while(~last && !ch[last][c]) ch[last][c] = cur, last = link[last];
      |                                                                     ^
answer.code:28:69: error: invalid conversion from ‘int (*)(const char*, const char*) noexcept’ to ‘int’ [-fpermissive]
   28 |     while(~last && !ch[last][c]) ch[last][c] = cur, last = link[last];
      |                                                            ~~~~~~~~~^
      |                                                                     |
      |                                                                     int (*)(const char*, const char*) noexcept
answer.code:29:28: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   29 |     if(last == -1) link[cur] = 0;
      |                            ^
answer.code:29:30: error: assignment of read-only location ‘*(link + ((sizetype)cur))’
   29 |     if(last == -1) link[cur] = 0;
      |                    ~~~~~~~~~~^~~
answer.code:32:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   32 |         if(len[last] + 1 == len[q]) link[cur] = q;
      |                                             ^
answer.code:32:47: error: assignment of read-only location ‘*(link + ((sizetype)cur))’
   32 |         if(len[last] + 1 == len[q]) link[cur] = q;
      |                                     ~~~~~~~~~~^~~
answer.code:35:96: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   35 |             memcpy(ch[clone], ch[q], sizeof(ch[clone])); len[clone] = len[last] + 1; link[clone] = link[q];
      |                                                                                                ^
answer.code:35:106: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   35 |             memcpy(ch[clone], ch[q], sizeof(ch[clone])); len[clone] = len[last] + 1; link[clone] = link[q];
      |                                                                                                          ^
answer.code:35:98: error: assignment of read-only location ‘*(link + ((sizetype)clone))’
   35 |             memcpy(ch[clone], ch[q], sizeof(ch[clone])); len[clone] = len[last] + 1; link[clone] = link[q];
      |                                                                                      ~~~~~~~~~~~~^~~~~~~~~
answer.code:36:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   36 |             link[cur] = link[q] = clone;
      |                     ^
answer.code:36:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   36 |             link[cur] = link[q] = clone;
      |                               ^
answer.code:36:33: error: assignment of read-only location ‘*(link + ((sizetype)q))’
   36 |             link[cur] = link[q] = clone;
      |                         ~~~~~~~~^~~~~~~
answer.code:37:83: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   37 |             while(~last && ch[last][c] == q) ch[last][c] = clone, last = link[last];
      |                                                                                   ^
answer.code:37:83: error: invalid conversion from ‘int (*)(const char*, const char*) noexcept’ to ‘int’ [-fpermissive]
   37 |             while(~last && ch[last][c] == q) ch[last][c] = clone, last = link[last];
      |                                                                          ~~~~~~~~~^
      |                                                                                   |
      |                                                                                   int (*)(const char*, const char*) noexcept
answer.code: In function ‘int main()’:
answer.code:47:20: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   47 | int main() { link[0] = -1;
      |                    ^
answer.code:47:22: error: assignment of read-only location ‘* link’
   47 | int main() { link[0] = -1;
      |              ~~~~~~~~^~~~
answer.code:55:56: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   55 |                 _rep(i,1,nc) ans += len[i] - len[link[i]];
      |       ...