QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#101639#6377. LaLa and Magic Stonerunewrz#Compile Error//C++203.3kb2023-04-30 16:11:032023-04-30 16:11:07

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-30 16:11:07]
  • 评测
  • [2023-04-30 16:11:03]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long

const int N = 1005;
char tu[N][N];
const ll mod = 998244353;
int n,m;

bool inside(int x,int y){
    if(x >= 1 && x <= n && y >= 1 && y <= m)return 1;
    return 0;
}

bool ok1(int x,int y){
    int flag = 1;
    for(int i=0;i<4;i++){
        for(int j=0;j<4;j++){
            if(i==0 && j == 3)continue;
            if(i==3 && j == 0)continue;
            if(!inside(x+i,y+j))flag = 0;
            if(tu[x + i][y + j]!='0')flag = 0;
        }
    }

    if(flag){
        for(int i=0;i<4;i++){
            for(int j=0;j<4;j++){
                if(i==0 && j == 3)continue;
                if(i==3 && j == 0)continue;
                tu[x + i][y + j] = 'x';
            }
        }        
        return 1;
    }
    flag = 1;
    y--;
    if(y==0)return 0;
    for(int i=0;i<4;i++){
        for(int j=0;j<4;j++){
            if(i==0 && j == 0)continue;
            if(i==3 && j == 3)continue;
            if(!inside(x+i,y+j))flag = 0;
            if(tu[x + i][y + j]!='0')flag = 0;
        }
    }

    if(flag){
        for(int i=0;i<4;i++){
            for(int j=0;j<4;j++){
                if(i==0 && j == 0)continue;
                if(i==3 && j == 3)continue;
                tu[x + i][y + j] = 'x';
            }
        }        
        return 1;
    }

    return 0;
}

int tx[] = {1,1,0,2};
int ty[] = {0,2,1,1};

bool ok2(int x,int y){
    int base = 0;
    if(inside(x+2,y-1) && tu[x+2][y-1] == '0')base = 3;
    if(inside(x+2,y+3) && tu[x+2][y+3] == '0')base = 3;
    if(inside(x+3,y+2) && tu[x+3][y+2] == '0')base = 1;
    if(inside(x+3,y)   && tu[x+3][y]   == '0')base = 0;
    for(int k=0;k<4;k++){
        int flag = 1;
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                if(i==1 && j == 1)continue;
                if(i==tx[(k + base)%4] && j== ty[(k+base) % 4])continue;
                if(!inside(x+i,y+j))flag = 0;
                if(tu[x+i][y+j]!='0')flag = 0;
            }
        }
        if(flag){
            for(int i=0;i<3;i++){
                for(int j=0;j<3;j++){
                    if(i==1 && j == 1)continue;
                    if(i==tx[(k + base)%4] && j== ty[(k+base) % 4])continue;
                    tu[x+i][y+j] = 'x';
                }
            }            
            return 1;
        }
    }
    return 0;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m;
    for(int i=1;i<=n;i++){
        cin >> (tu[i]+1);
    }
// for(int i=1;i<=n;i++){
//     for(int j=1;j<=m;j++){
//         cout << tu[i][j];
//     }
//     cout << endl;
// }
    ll ans = 1;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(tu[i][j] == '0'){
                if(ok1(i,j)){
                    ans *= 2;
                    ans %= mod;
//cout << "ok1" << endl;
                }else if(ok2(i,j)){
//cout << "dwa" << endl;
                }
                else ans = 0;
                if(ans == 0)break;
            }else continue;
        }
        if(ans == 0)break;
    }
//cout << ans << endl;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(tu[i][j] == '0')ans = 0;
        }
    }
    cout << ans << endl;
}

Details

answer.code: In function ‘int main()’:
answer.code:100:13: error: no match for ‘operator>>’ (operand types are ‘std::istream’ {aka ‘std::basic_istream<char>’} and ‘char*’)
  100 |         cin >> (tu[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:100:22: error: cannot bind non-const lvalue reference of type ‘bool&’ to a value of type ‘char*’
  100 |         cin >> (tu[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:100:22: error: invalid conversion from ‘char*’ to ‘short int’ [-fpermissive]
  100 |         cin >> (tu[i]+1);
      |                ~~~~~~^~~
      |                      |
      |                      char*
answer.code:100:22: error: cannot bind rvalue ‘(short int)(((char*)(& tu[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:100:22: error: invalid conversion from ‘char*’ to ‘short unsigned int’ [-fpermissive]
  100 |         cin >> (tu[i]+1);
      |                ~~~~~~^~~
      |                      |
      |                      char*
answer.code:100:22: error: cannot bind rvalue ‘(short unsigned int)(((char*)(& tu[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:100:22: error: invalid conversion from ‘char*’ to ‘int’ [-fpermissive]
  100 |         cin >> (tu[i]+1);
      |                ~~~~~~^~~
      |                      |
      |                      char*
answer.code:100:22: error: cannot bind rvalue ‘(int)(((char*)(& tu[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::basic_istream<char>]’ (near match)
  182 |       operator>>(unsigned int& __n)
      |       ^~~~~~~~
/usr/include/c++/11/istream:182:7: note:   c...