QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#412711#6746. Merge the RectanglesSunlight9#Compile Error//C++201.6kb2024-05-16 18:28:562024-05-16 18:28:57

Judging History

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

  • [2024-05-16 18:28:57]
  • 评测
  • [2024-05-16 18:28:56]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
const int MAXN=1607;
int n,m;
int a[MAXN][MAXN],b[MAXN][MAXN];
char s[MAXN];
int tot=0;
bool dfs(int min_x,int min_y,int max_x,int max_y)
{
    bool kkk=0,qqq=0,hhh=0;
    // cerr<<" "<<min_x<<" "<<min_y<<' '<<max_x<<' '<<max_y<<"  asd"<<endl;
    for(int i=min_x;i<max_x;i++)
    {
        if(a[i][max_y]-a[i][min_y-1]>0) hhh=1;
        if(a[i][max_y]-a[i][min_y-1]==max_y-min_y+1)
        {
            qqq=1;
            kkk=dfs(min_x,min_y,i,max_y)&dfs(i+1,min_y,max_x,max_y);
            break;
        }
    }
    
    if(qqq) return kkk;
    
    for(int i=min_y;i<max_y;i++)
    {
        // cerr<<i<<" "<<min_x<<" "<<max_x<<' '<<min_y<<' '<<max_y<<"  asd"<<endl;
        if(b[max_x][i]-b[min_x-1][i]>0) hhh=1;
        if(b[max_x][i]-b[min_x-1][i]==max_x-min_x+1)
        {
            qqq=1;
            kkk=dfs(min_x,min_y,max_x,i)&dfs(min_x,i+1,max_x,max_y);
            break;
        }
    }
    
    if(!hhh) kkk=1;
    // cerr<<kkk<<" "<<min_x<<" "<<max_x<<' '<<min_y<<' '<<max_y<<"  asd"<<endl;
    return kkk;
}
int main() {
    cin.tie(nullptr) -> sync_with_stdio(false);

    cin>>n>>m;

    for(int i=1;i<n;i++)
    {
        cin>>s+1;
        for(int j=1;j<=m;j++) a[i][j]=s[j]-'0';
    }

    for(int i=1;i<=n;i++)
    {
        cin>>s+1;
        for(int j=1;j<m;j++) b[i][j]=s[j]-'0';
    }

    for(int i=1;i<n;i++)
    {
        for(int j=1;j<=m;j++) a[i][j]+=a[i][j-1];
    }
    for(int j=1;j<m;j++)
    {
        for(int i=1;i<=n;i++) b[i][j]+=b[i-1][j];
    }

    
    if(dfs(1,1,n,m)) cout<<"YES";
    else cout<<"NO";
    return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:49:12: error: no match for ‘operator>>’ (operand types are ‘std::istream’ {aka ‘std::basic_istream<char>’} and ‘char*’)
   49 |         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:49:15: error: cannot bind non-const lvalue reference of type ‘void*&’ to an rvalue of type ‘void*’
   49 |         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:49:15: error: invalid conversion from ‘char*’ to ‘long long unsigned int’ [-fpermissive]
   49 |         cin>>s+1;
      |              ~^~
      |               |
      |               char*
answer.code:49:15: 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:49:15: error: invalid conversion from ‘char*’ to ‘long long int’ [-fpermissive]
   49 |         cin>>s+1;
      |              ~^~
      |               |
      |               char*
answer.code:49:15: 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:49:15: error: invalid conversion from ‘char*’ to ‘long unsigned int’ [-fpermissive]
   49 |         cin>>s+1;
      |              ~^~
      |               |
      |               char*
answer.code:49:15: 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:49:15: error: invalid conversion from ‘char*’ to ‘long int’ [-fpermissive]
   49 |         cin>>s+1;
      |              ~^~
      |               |
      |               char*
answer.code:49:15: 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:49:15: error: invalid conversion from ‘char*’ to ‘unsigned int’ [-fpermissive]
   49 |         cin>>s+1;
      |              ~^~
      |               |
      |               char*
answer.code:49:15: error: cannot bind rvalue ‘(unsigned int)(((char*)(& s)) + 1)’ to ‘unsigned int&’
/usr/include/c++/13/istream:181:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>& std::basi...