10539 | 2024-04-04 18:43:24 | 111 | Stefan sakkmesteri ambíciói | cpp17 | Accepted 100/100 | 4ms | 4768 KiB |
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;
cin>>T;
while(T--){
char x[10][10]{};
for(int i=1;i<=8;i++){
for(int j=1;j<=8;j++){
cin>>x[i][j];
}
}
int ok=0;
for(int i=1;i<=8;i++){
for(int j=1;j<=8;j++){
if(x[i][j]=='q'){
for(int k=j+1;;k++){
if(x[i][k]!='.'){
if(x[i][k]=='R'||x[i][k]=='Q'){
ok=1;
}
break;
}
}
for(int k=j-1;;k--){
if(x[i][k]!='.'){
if(x[i][k]=='R'||x[i][k]=='Q'){
ok=1;
}
break;
}
}
for(int k=i+1;;k++){
if(x[k][j]!='.'){
if(x[k][j]=='R'||x[k][j]=='Q'){
ok=1;
}
break;
}
}
for(int k=i-1;;k--){
if(x[k][j]!='.'){
if(x[k][j]=='R'||x[k][j]=='Q'){
ok=1;
}
break;
}
}
for(int k=i+1,l=j+1;;k++,l++){
if(x[k][l]!='.'){
if(x[k][l]=='B'||x[k][l]=='Q'){
ok=1;
}
break;
}
}
for(int k=i+1,l=j-1;;k++,l--){
if(x[k][l]!='.'){
if(x[k][l]=='B'||x[k][l]=='Q'){
ok=1;
}
break;
}
}
for(int k=i-1,l=j+1;;k--,l++){
if(x[k][l]!='.'){
if(x[k][l]=='B'||x[k][l]=='Q'){
ok=1;
}
break;
}
}
for(int k=i-1,l=j-1;;k--,l--){
if(x[k][l]!='.'){
if(x[k][l]=='B'||x[k][l]=='Q'){
ok=1;
}
break;
}
}
for(int k=1;k<=8;k++){
for(int l=1;l<=8;l++){
if(x[k][l]=='N'&&(abs(k-i)==1&&abs(l-j)==2||abs(k-i)==2&&abs(l-j)==1)){
ok=1;
}
}
}
if(x[i+1][j-1]=='P'||x[i+1][j+1]=='P'){
ok=1;
}
}
}
}
cout<<(ok?"YES":"NO")<<'\n';
}
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1892 KiB | ||||
subtask2 | 11/11 | ||||||
2 | Accepted | 3ms | 2268 KiB | ||||
3 | Accepted | 3ms | 2384 KiB | ||||
4 | Accepted | 3ms | 2604 KiB | ||||
5 | Accepted | 4ms | 2820 KiB | ||||
subtask3 | 12/12 | ||||||
6 | Accepted | 3ms | 2964 KiB | ||||
7 | Accepted | 3ms | 3168 KiB | ||||
8 | Accepted | 3ms | 3396 KiB | ||||
9 | Accepted | 4ms | 3548 KiB | ||||
subtask4 | 15/15 | ||||||
10 | Accepted | 3ms | 3728 KiB | ||||
11 | Accepted | 3ms | 3936 KiB | ||||
12 | Accepted | 3ms | 4180 KiB | ||||
13 | Accepted | 4ms | 4264 KiB | ||||
subtask5 | 16/16 | ||||||
14 | Accepted | 2ms | 4236 KiB | ||||
15 | Accepted | 3ms | 4332 KiB | ||||
16 | Accepted | 3ms | 4468 KiB | ||||
17 | Accepted | 4ms | 4568 KiB | ||||
subtask6 | 46/46 | ||||||
18 | Accepted | 3ms | 4544 KiB | ||||
19 | Accepted | 3ms | 4448 KiB | ||||
20 | Accepted | 3ms | 4548 KiB | ||||
21 | Accepted | 4ms | 4656 KiB | ||||
22 | Accepted | 4ms | 4560 KiB | ||||
23 | Accepted | 4ms | 4680 KiB | ||||
24 | Accepted | 4ms | 4684 KiB | ||||
25 | Accepted | 4ms | 4768 KiB | ||||
26 | Accepted | 4ms | 4676 KiB |