QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#222091#6552. Good and Lucky Matricesucup-team004#Compile Error//C++201.3kb2023-10-21 15:45:452023-10-21 15:45:45

Judging History

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

  • [2023-10-21 15:45:45]
  • 评测
  • [2023-10-21 15:45:45]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
const int N=2005;
char ch[N][N];
int n;
bitset<N> ans[N],s[N],jl[N],tmp[N];
int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int t;
    string str;
    cin>>t;
    while(t--){
        cin>>str;
        cin>>n;
        For(i,1,n)cin>>(ch[i]+1);
        For(i,1,n)For(j,1,n)s[i][j]=ch[i][j]-'0';
        For(i,1,n)ans[i]=0;
        if(str=="good"){
            For(i,1,n){
                int p=0;
                For(j,1,n)if(s[i][j]){
                    p=j; break;
                }
                assert(p);
                ans[i]|=s[i];
                For(j,i+1,n)if(s[j][p]){ans[j][p]=1; s[j]^=s[i];}
            }
        }else{
            For(i,1,n)jl[i]=0;
            For(i,1,n){
                int p=0;
                For(j,1,n)if(s[i][j]){
                    p=j; For(k,i+1,n)if(s[k][p]){s[k][p]=0; jl[i][k]=1;} break;
                }
                assert(p);
                tmp[i]=ans[i]=s[i];
                For(j,1,i-1)if(jl[j][i]){
                    ans[i]^=tmp[j];
                }
            }
        }
        cout<<n<<"\n";
        For(i,1,n){
            For(j,1,n)cout<<ans[i][j]; cout<<"\n";
        }
    }
}

Details

answer.code: In function ‘int main()’:
answer.code:17:22: error: no match for ‘operator>>’ (operand types are ‘std::istream’ {aka ‘std::basic_istream<char>’} and ‘char*’)
   17 |         For(i,1,n)cin>>(ch[i]+1);
      |                   ~~~^~~~~~~~~~~
      |                   |          |
      |                   |          char*
      |                   std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from answer.code:1:
/usr/include/c++/11/istream:168:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ (near match)
  168 |       operator>>(bool& __n)
      |       ^~~~~~~~
/usr/include/c++/11/istream:168:7: note:   conversion of argument 1 would be ill-formed:
answer.code:17:30: error: cannot bind non-const lvalue reference of type ‘bool&’ to a value of type ‘char*’
   17 |         For(i,1,n)cin>>(ch[i]+1);
      |                        ~~~~~~^~~
In file included from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from answer.code:1:
/usr/include/c++/11/istream:172:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]’ (near match)
  172 |       operator>>(short& __n);
      |       ^~~~~~~~
/usr/include/c++/11/istream:172:7: note:   conversion of argument 1 would be ill-formed:
answer.code:17:30: error: invalid conversion from ‘char*’ to ‘short int’ [-fpermissive]
   17 |         For(i,1,n)cin>>(ch[i]+1);
      |                        ~~~~~~^~~
      |                              |
      |                              char*
answer.code:17:30: error: cannot bind rvalue ‘(short int)(((char*)(& ch[i])) + 1)’ to ‘short int&’
In file included from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from answer.code:1:
/usr/include/c++/11/istream:175:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ (near match)
  175 |       operator>>(unsigned short& __n)
      |       ^~~~~~~~
/usr/include/c++/11/istream:175:7: note:   conversion of argument 1 would be ill-formed:
answer.code:17:30: error: invalid conversion from ‘char*’ to ‘short unsigned int’ [-fpermissive]
   17 |         For(i,1,n)cin>>(ch[i]+1);
      |                        ~~~~~~^~~
      |                              |
      |                              char*
answer.code:17:30: error: cannot bind rvalue ‘(short unsigned int)(((char*)(& ch[i])) + 1)’ to ‘short unsigned int&’
In file included from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from answer.code:1:
/usr/include/c++/11/istream:179:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]’ (near match)
  179 |       operator>>(int& __n);
      |       ^~~~~~~~
/usr/include/c++/11/istream:179:7: note:   conversion of argument 1 would be ill-formed:
answer.code:17:30: error: invalid conversion from ‘char*’ to ‘int’ [-fpermissive]
   17 |         For(i,1,n)cin>>(ch[i]+1);
      |                        ~~~~~~^~~
      |                              |
      |                              char*
answer.code:17:30: error: cannot bind rvalue ‘(int)(((char*)(& ch[i])) + 1)’ to ‘int&’
In file included from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from answer.code:1:
/usr/include/c++/11/istream:182: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>; std::basic_istream<_CharT, _Traits>::__istream_type = std::...