QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#332181#7877. Balanced Arraysumi007Compile Error//C++231.3kb2024-02-19 11:26:052024-02-19 11:26:05

Judging History

你现在查看的是最新测评结果

  • [2024-02-19 11:26:05]
  • 评测
  • [2024-02-19 11:26:05]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define i64 __int128
#define db double
#define ldb long double
#define ull unsigned long long
#define ll long long
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define lowbit(i) (i&-i) 
const ll N = 3e6+5,P = 131;
ll n,a[N],hs[N],pw[N];
char s[N];
ll ask(int l,int r){
    return hs[r]-hs[l-1]*pw[r-l+1];
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cin >> n;
    for(int t=1;t<=n;t++){
        cin >> s+1;
        int len = strlen(s+1);
        for(int i=1,now;i<=len;i++){
            if('0'<=s[i] && s[i]<='9') now = s[i]-'0';
            else if('a'<=s[i] && s[i]<='z') now = 10+s[i]-'a';
            else now = 36+s[i]-'A';
            a[t] = a[t]*62+now;
        }
    }
    pw[0] = 1;
    for(int i=1;i<=n;i++) pw[i] = pw[i-1]*P;
    for(int i=1;i<=n;i++) hs[i] = hs[i-1]*P+a[i];
    for(int i=1,k=1;i<=n;i++){
        if(k>(i-1)/2){
            cout << 0;
            continue;
        }
        if(a[i]+a[i-2*k] != 2*a[i-k]){
            while(1){
                k++;
                if(k>(i-1)/2) break;
                if(ask(1,i-2*k)+ask(i+2*k,i) == 2*ask(1+k,i-k)) break;
            }
        }
        if(k>(i-1)/2) cout << 0;
        else cout << 1;
    }
    return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:24:13: error: no match for ‘operator>>’ (operand types are ‘std::istream’ {aka ‘std::basic_istream<char>’} and ‘char*’)
   24 |         cin >> s+1;
      |         ~~~ ^~ ~~~
      |         |       |
      |         |       char*
      |         std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/13/sstream:40,
                 from /usr/include/c++/13/complex:45,
                 from /usr/include/c++/13/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:127,
                 from answer.code:1:
/usr/include/c++/13/istream:325:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  325 |       operator>>(void*& __p)
      |       ^~~~~~~~
/usr/include/c++/13/istream:325:7: note:   conversion of argument 1 would be ill-formed:
answer.code:24:17: error: cannot bind non-const lvalue reference of type ‘void*&’ to an rvalue of type ‘void*’
   24 |         cin >> s+1;
      |                ~^~
/usr/include/c++/13/istream:201:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  201 |       operator>>(unsigned long long& __n)
      |       ^~~~~~~~
/usr/include/c++/13/istream:201:7: note:   conversion of argument 1 would be ill-formed:
answer.code:24:17: error: invalid conversion from ‘char*’ to ‘long long unsigned int’ [-fpermissive]
   24 |         cin >> s+1;
      |                ~^~
      |                 |
      |                 char*
answer.code:24:17: error: cannot bind rvalue ‘(long long unsigned int)(((char*)(& s)) + 1)’ to ‘long long unsigned int&’
/usr/include/c++/13/istream:197:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  197 |       operator>>(long long& __n)
      |       ^~~~~~~~
/usr/include/c++/13/istream:197:7: note:   conversion of argument 1 would be ill-formed:
answer.code:24:17: error: invalid conversion from ‘char*’ to ‘long long int’ [-fpermissive]
   24 |         cin >> s+1;
      |                ~^~
      |                 |
      |                 char*
answer.code:24:17: error: cannot bind rvalue ‘(long long int)(((char*)(& s)) + 1)’ to ‘long long int&’
/usr/include/c++/13/istream:192:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  192 |       operator>>(unsigned long& __n)
      |       ^~~~~~~~
/usr/include/c++/13/istream:192:7: note:   conversion of argument 1 would be ill-formed:
answer.code:24:17: error: invalid conversion from ‘char*’ to ‘long unsigned int’ [-fpermissive]
   24 |         cin >> s+1;
      |                ~^~
      |                 |
      |                 char*
answer.code:24:17: error: cannot bind rvalue ‘(long unsigned int)(((char*)(& s)) + 1)’ to ‘long unsigned int&’
/usr/include/c++/13/istream:188:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  188 |       operator>>(long& __n)
      |       ^~~~~~~~
/usr/include/c++/13/istream:188:7: note:   conversion of argument 1 would be ill-formed:
answer.code:24:17: error: invalid conversion from ‘char*’ to ‘long int’ [-fpermissive]
   24 |         cin >> s+1;
      |                ~^~
      |                 |
      |                 char*
answer.code:24:17: error: cannot bind rvalue ‘(long int)(((char*)(& s)) + 1)’ to ‘long int&’
/usr/include/c++/13/istream:184:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  184 |       operator>>(unsigned int& __n)
      |       ^~~~~~~~
/usr/include/c++/13/istream:184:7: note:   conversion of argument 1 would be ill-formed:
answer.code:24:17: error: invalid conversion from ‘char*’ to ‘unsigned int’ [-fpermissive]
   24 |         cin >> s+1;
      |                ~^~
      |                 |
      |                 char*
answer.code:24:17: error: cannot bind rvalue ‘(unsigned int)(((char*)(& s)) + 1)’ to ‘unsigned int&’
/usr/include/c++/13/istream:181:7: note: candid...