QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#399396#6611. United in StormwindRegister#Compile Error//C++20903b2024-04-26 12:30:432024-04-26 12:30:44

Details

answer.code: In function ‘int main()’:
answer.code:7:499: error: no match for ‘operator>>’ (operand types are ‘std::istream’ {aka ‘std::basic_istream<char>’} and ‘char*’)
    7 | using namespace std;typedef long long ll;const int N=(1<<20)+5;double Cor[2][2]={{1,0},{1,1}},Cand[2][2]={{1,1},{0,1}},Cxor[2][2]={{1,1},{1,-1}},ICor[2][2]={{1,0},{-1,1}},ICand[2][2]={{1,-1},{0,1}},ICxor[2][2]={{0.5,0.5},{0.5,-0.5}};int n,m;ll _n,K;double f[N],g[N];void FWT(double*f,double c[2][2]){for(int i=1;i<n;i<<=1)for(int j=0;j<n;j+=i<<1)for(int k=j;k<i+j;k++){long long x=f[k],y=f[k+i];f[k]=c[0][0]*x+c[0][1]*y;f[k+i]=c[1][0]*x+c[1][1]*y;}}int main(){cin>>n>>m>>K;rep(i,1,n){char s[25];cin>>s+1;int w=0;rep(i,1,m)w=(w<<1)|(s[i]=='B');f[w]+=1;}_n=n;n=1<<m;FWT(f,Cxor);rep(i,0,n-1)f[i]=f[i]*f[i];FWT(f,ICxor);rep(i,0,n-2)g[i]=f[(n-1)^i]/2;g[n-1]=(f[0]-_n)/2;FWT(g,Cand);ll sum=0;rep(i,1,n-1)if(_n*(_n-1)/2-g[i]>=K)sum++;cout<<sum;return 0;}
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ~~~^~~~~
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |     |
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |     char*
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/13/iostream:42,
                 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:7:502: error: cannot bind non-const lvalue reference of type ‘void*&’ to an rvalue of type ‘void*’
    7 | using namespace std;typedef long long ll;const int N=(1<<20)+5;double Cor[2][2]={{1,0},{1,1}},Cand[2][2]={{1,1},{0,1}},Cxor[2][2]={{1,1},{1,-1}},ICor[2][2]={{1,0},{-1,1}},ICand[2][2]={{1,-1},{0,1}},ICxor[2][2]={{0.5,0.5},{0.5,-0.5}};int n,m;ll _n,K;double f[N],g[N];void FWT(double*f,double c[2][2]){for(int i=1;i<n;i<<=1)for(int j=0;j<n;j+=i<<1)for(int k=j;k<i+j;k++){long long x=f[k],y=f[k+i];f[k]=c[0][0]*x+c[0][1]*y;f[k+i]=c[1][0]*x+c[1][1]*y;}}int main(){cin>>n>>m>>K;rep(i,1,n){char s[25];cin>>s+1;int w=0;rep(i,1,m)w=(w<<1)|(s[i]=='B');f[w]+=1;}_n=n;n=1<<m;FWT(f,Cxor);rep(i,0,n-1)f[i]=f[i]*f[i];FWT(f,ICxor);rep(i,0,n-2)g[i]=f[(n-1)^i]/2;g[n-1]=(f[0]-_n)/2;FWT(g,Cand);ll sum=0;rep(i,1,n-1)if(_n*(_n-1)/2-g[i]>=K)sum++;cout<<sum;return 0;}
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ~^~
/usr/include/c++/13/istream:201:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__is...