RT
本地编译可过。洛谷IDE c++
可过,然而 c++14
不可过。 Codeforces 不可过。
Can't compile file:
program.cpp: In function 'int main()':
program.cpp:25:15: error: unable to find character literal operator 'operator""or' with 'char' argument
if(a[1][1]=='A'or a[r][c]=='A'or a[1][c]=='A'or a[r][1]=='A')goto two;
^
program.cpp:25:21: error: expected ')' before 'a'
if(a[1][1]=='A'or a[r][c]=='A'or a[1][c]=='A'or a[r][1]=='A')goto two;
^
Code:
#include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;
int t,r,c,a[7][7];
bool alla,allp,ok;
int main(){
scanf("%d",&t);
while(t--){
scanf("%d%d",&r,&c),alla=1,allp=1;
for(int i=1;i<=r;i++)
for(int j=1;j<=c;j++){
a[i][j]='-';
while(!isalpha(a[i][j]))
a[i][j]=getchar();
alla&=(a[i][j]=='A'),
allp&=(a[i][j]=='P');
}
if(allp)goto gg;
if(alla)goto zero;
ok=1;for(int i=1;i<=r;i++)ok&=(a[i][1]=='A');if(ok)goto one;
ok=1;for(int i=1;i<=r;i++)ok&=(a[i][c]=='A');if(ok)goto one;
ok=1;for(int j=1;j<=c;j++)ok&=(a[1][j]=='A');if(ok)goto one;
ok=1;for(int j=1;j<=c;j++)ok&=(a[r][j]=='A');if(ok)goto one;
if(a[1][1]=='A'or a[r][c]=='A'or a[1][c]=='A'or a[r][1]=='A')goto two;
for(int i=1;i<=r;i++)if(a[i][1]=='A')goto three;
for(int i=1;i<=r;i++)if(a[i][c]=='A')goto three;
for(int j=1;j<=c;j++)if(a[1][j]=='A')goto three;
for(int j=1;j<=c;j++)if(a[r][j]=='A')goto three;
putchar('4'),putchar(10);goto ed;
gg :;puts("MORTAL");goto ed;
zero:;putchar('0'),putchar(10);goto ed;
one :;putchar('1'),putchar(10);goto ed;
two :;putchar('2'),putchar(10);goto ed;
three:;putchar('3'),putchar(10);goto ed;
ed:;
}
}