Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
923 B
2
Indexable
#include <iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n, m, q=0;
        bool b=0;
        cin>>n>>m;
        vector<vector<char>>a(n, vector<char>(m));
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                cin>>a[i][j];
            }
        }
        for(int i=0;i<m;i++){
          for(int j=0;j<n;j++){
           if(a[i][j]=='v'){
            q++;

           }
           if((a[i][j]=='i')&&(q=1)){
            q++;
           }
            if((a[i][j]=='k')&&(q=2)){
            q++;
           }
            if((a[i][j]=='a')&&(q=3)){
            b=1;
           }
          }
          q=0;
        }
        if(b){
            cout<<"YES"<<endl;
        }
        else{
            cout<<NO<<endl;
        }
    }
    return 0;
}