Untitled
unknown
c_cpp
a year ago
1.3 kB
2
Indexable
Never
#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 = false; 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 j = 0; j < m; j++) { for (int i = 0; i < n; i++) { if (a[i][j] == 'v' && q == 0) { q++; break; } if ((a[i][j] == 'i') && (q == 1)) { q++; break; } if ((a[i][j] == 'k') && (q == 2)) { q++; break; } if ((a[i][j] == 'a') && (q == 3)) { b = true; break; } } } if (b) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }