97142024-03-02 17:24:40IgnácStefan sakkmesteri ambícióicpp17Compilation error

// Source: https://usaco.guide/general/io

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

int main() {
    int t;

// Source: https://usaco.guide/general/io

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

int main() {
    int t;
    cin>>t;
    vector<string> a(8);
    for(int fghjk=0;fghjk<t;fghjk++){

        for(int i=0;i<8;i++){
            cin>>a[i];
        }
        bool b=false;
        int bish, k;
        for(int i=0;i<8;i++){
            for(int j=0;j<8;j++){
                k=i;
                bish=j;
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                if(a[i][j]=='N'){
                    if(i-2>=0 && j-1>=0){
                        if(a[i-2][j-1]=='q'){
                            b=true;
                            break;
                        }
                    }
                    if(i-2>=0 && j+1<=7){
                        if(a[i-2][j+1]=='q'){
                            b=true;
                            break;
                        }
                    }
                    if(i+2<=7 && j-1>=0){
                        if(a[i+2][j-1]=='q'){
                            b=true;
                            break;
                        }
                    }
                    if(i+2<=7 && j+1<=7){
                        if(a[i+2][j+1]=='q'){
                            b=true;
                            break;
                        }
                    }
                    if(i-1>=0 && j-2>=0){
                        if(a[i-1][j-2]=='q'){
                            b=true;
                            break;
                        }
                    }
                    if(i-1>=0 && j+2<=7){
                        if(a[i-1][j+2]=='q'){
                            b=true;
                            break;
                        }
                    }
                    if(i+1<=7 && j-2>=0){
                        if(a[i+1][j-2]=='q'){
                            b=true;
                            break;
                        }
                    }
                    if(i+1<=7 && j+2<=7){
                        if(a[i+1][j+2]=='q'){
                            b=true;
                            break;
                        }
                    }
                }
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                if(a[i][j]=='B'){
                    k=i;
                    bish=j;
                    while(k>=0 && bish>=0){
                        k--;
                        bish--;
                        if(bish<0 || k<0){
                            break;
                        }
                        if(a[k][bish]=='q'){
                            b=true;
                            break;
                        }
                        if(a[k][bish]!='.'){
                            break;
                        }
                        
                    }
                    if(b){
                        break;
                    }
                    k=i;
                    bish=j;
                    while(k<=7 && bish>=0){
                        k++;
                        bish--;
                        if(bish<0 || k>7){
                            break;
                        }
                        if(a[k][bish]=='q'){
                            b=true;
                            break;
                        }
                        if(a[k][bish]!='.'){
                            break;
                        }
                        
                    }
                    k=i;
                    bish=j;
                    if(b){
                        break;
                    }
                    while(k>=0 && bish<=7){
                        k--;
                        bish++;
                        if(bish>7 || k<0){
                            break;
                        }
                        if(a[k][bish]=='q'){
                            b=true;
                    //      cout<<"I am right here\n";
                            break;
                        }
                        if(a[k][bish]!='.'){
                            break;
                        }
                    //  cout<<k<<' '<<bish<<'\n';
                        
                    }
                    k=i;
                    bish=j;
                    if(b){
                        break;
                    }
                    while(k<=7 && bish<=7){
                        k++;
                        bish++;
                        if(bish>7 || k>7){
                            break;
                        }
                        if(a[k][bish]=='q'){
                            b=true;
                            break;
                        }
                        if(a[k][bish]!='.'){
                            break;
                        }
                        
                    }
                    k=i;
                    bish=j;
                    if(b){
                        break;
                    }
                }
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                if(a[i][j]=='R'){
                    j=i;
                    bish=j;
                    while(k>=0){
                        k--;
                        if(k<0){
                            break;
                        }
                        if(a[k][bish]=='q'){
                            b=true;
                            break;
                        }
                        if(a[k][bish]!='.'){
                            break;
                        }
                    }
                    k=i;
                    bish=j;
                    if(b){
                        break;
                    }
                    while(k<=7){
                        k++;
                        if(k>7){
                            break;
                        }
                        if(a[k][bish]=='q'){
                            b=true;
                            break;
                        }
                        if(a[k][bish]!='.'){
                            break;
                        }
                        
                    }
                    k=i;
                    bish=j;
                    if(b){
                        break;
                    }
                    while(bish<=7){
                        bish++;
                        if(bish>7){
                            break;
                        }
                        if(a[k][bish]=='q'){
                            b=true;
                            break;
                        }
                        if(a[k][bish]!='.'){
                            break;
                        }
                        
                    }
                    k=i;
                    bish=j;
                    if(b){
                        break;
                    }
                    while(bish>=0){
                        bish--;
                        if(bish<0){
                            break;
                        }
                        if(a[k][bish]=='q'){
                            b=true;
                            break;
                        }
                        if(a[k][bish]!='.'){
                            break;
                        }
                        
                    }
                    k=i;
                    bish=j;
                    if(b){
                        break;
                    }
                }














                if(a[i][j]=='P'){
                    if(i-1>=0 && j-1>=0){
                        if(a[i-1][j-1]=='q'){
                            b=true;
                            break;
                        }
                    }
                    if(i-1>=0 && j+1<=7){
                        if(a[i-1][j+1]=='q'){
                            b=true;
                            break;
                        }
                    }
                }

















                if(a[i][j]=='Q'){
                    k=i;
                    bish=j;
                    while(k>=0){
                        k--;
                        if(k<0){
                            break;
                        }
                        if(a[k][bish]=='q'){
                            b=true;
                            break;
                        }
                        if(a[k][bish]!='.'){
                            break;
                        }
                        
                    }
                    k=i;
                    bish=j;
                    if(b){
                        break;
                    }
                    while(k<=7){
                        k++;
                        if(k>8){
                            break;
                        }
                        if(a[k][bish]=='q'){
                            b=true;
                            break;
                        }
                        if(a[k][bish]!='.'){
                            break;
                        }
                        
                    }
                    k=i;
                    bish=j;
                    if(b){
                        break;
                    }
                    while(bish<=7){
                        bish++;
                        if(bish>7){
                            break;
                        }
                        if(a[k][bish]=='q'){
                            b=true;
                            break;
                        }
                        if(a[k][bish]!='.'){
                            break;
                        }
                        
                    }
                    k=i;
                    bish=j;
                    if(b){
                        break;
                    }
                    while(bish>=0){
                        bish--;
                        if(bish<0){
                            break;
                        }
                        if(a[k][bish]=='q'){
                            b=true;
                            break;
                        }
                        if(a[k][bish]!='.'){
                            break;
                        }
                        
                    }
                    k=i;
                    bish=j;
                    if(b){
                        break;
                    }
                    k=i, bish=j;
                    while(k>=0 && bish>=0){
                        k--;
                        bish--;
                        if(k<0 || bish<0){
                            break;
                        }
                        if(a[k][bish]=='q'){
                            b=true;
                            break;
                        }
                        if(a[k][bish]!='.'){
                            break;
                        }
                        
                    }
                    if(b){
                        break;
                    }
                    k=i;
                    bish=j;
                    while(k<=7 && bish>=0){
                        k++;
                        bish--;
                        if(k>7 || bish<0){
                            break;
                        }
                        if(a[k][bish]=='q'){
                            b=true;
                            break;
                        }
                        if(a[k][bish]!='.'){
                            break;
                        }
                        
                    }
                    k=i;
                    bish=j;
                    if(b){
                        break;
                    }
                    while(k>=0 && bish<=7){
                        k--;
                        bish++;
                        if(k<0 || bish>7){
                            break;
                        }
                        if(a[k][bish]=='q'){
                            b=true;
                            break;
                        }
                        if(a[k][bish]!='.'){
                            break;
                        }
                        
                    }
                    k=i;
                    bish=j;
                    if(b){
                        break;
                    }
                    while(k<=7 && bish<=7){
                        k++;
                        bish++;
                        if(k>7 || bish>7){
                            break;
                        }
                        if(a[k][bish]=='q'){
                            b=true;
                            break;
                        }
                        if(a[k][bish]!='.'){
                            break;
                        }
                        
                    }
                    k=i;
                    bish=j;
                    if(b){
                        break;
                    }
                }
            }
            if(b){
                break;
            }
        }
        if(!b){
            cout<<"NO\n";
        }else{
            cout<<"YES\n";
        }
    }
}



    cin>>t;


// Source: https://usaco.guide/general/io

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

int main() {
    int t;
    cin>>t;
    vector<string> a(8);
    for(int fghjk=0;fghjk<t;fghjk++){

        for(int i=0;i<8;i++){
            cin>>a[i];
        }
        bool b=false;
        int bish, k;
        for(int i=0;i<8;i++){
            for(int j=0;j<8;j++){
                k=i;
                bish=j;
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                if(a[i][j]=='N'){
                    if(i-2>=0 && j-1>=0){
                        if(a[i-2][j-1]=='q'){
                            b=true;
                            break;
                        }
                    }
                    if(i-2>=0 && j+1<=7){
                        if(a[i-2][j+1]=='q'){
                            b=true;
                            break;
                        }
                    }
                    if(i+2<=7 && j-1>=0){
                        if(a[i+2][j-1]=='q'){
                            b=true;
                            break;
                        }
                    }
                    if(i+2<=7 && j+1<=7){
                        if(a[i+2][j+1]=='q'){
                            b=true;
                            break;
                        }
                    }
                    if(i-1>=0 && j-2>=0){
                        if(a[i-1][j-2]=='q'){
                            b=true;
                            break;
                        }
                    }
                    if(i-1>=0 && j+2<=7){
                        if(a[i-1][j+2]=='q'){
                            b=true;
                            break;
                        }
                    }
                    if(i+1<=7 && j-2>=0){
                        if(a[i+1][j-2]=='q'){
                            b=true;
                            break;
                        }
                    }
                    if(i+1<=7 && j+2<=7){
                        if(a[i+1][j+2]=='q'){
                            b=true;
                            break;
                        }
                    }
                }
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                if(a[i][j]=='B'){
                    k=i;
                    bish=j;
                    while(k>=0 && bish>=0){
                        k--;
                        bish--;
                        if(bish<0 || k<0){
                            break;
                        }
                        if(a[k][bish]=='q'){
                            b=true;
                            break;
                        }
                        if(a[k][bish]!='.'){
                            break;
                        }
                        
                    }
                    if(b){
                        break;
                    }
                    k=i;
                    bish=j;
                    while(k<=7 && bish>=0){
                        k++;
                        bish--;
                        if(bish<0 || k>7){
                            break;
                        }
                        if(a[k][bish]=='q'){
                            b=true;
                            break;
                        }
                        if(a[k][bish]!='.'){
                            break;
                        }
                        <
Compilation error
exit status 1
main.cpp: In function 'int main()':
main.cpp:15:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   15 | int main() {
      |         ^~
main.cpp:15:9: note: remove parentheses to default-initialize a variable
   15 | int main() {
      |         ^~
      |         --
main.cpp:15:9: note: or replace parentheses with braces to value-initialize a variable
main.cpp:15:12: error: a function-definition is not allowed here before '{' token
   15 | int main() {
      |            ^
main.cpp:537:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
  537 | int main() {
      |         ^~
main.cpp:537:9: note: remove parentheses to default-initialize a variable
  537 | int main() {
      |         ^~
      |         --
main.cpp:537:9: note: or replace parentheses with braces to value-initialize a variable
main.cpp:537:12: error: a function-definition is not allowed here before '{' token
  537 | int main() {
      |            ^
main.cpp:...