-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGift.cpp
44 lines (41 loc) · 837 Bytes
/
Gift.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include<bits/stdc++.h>
using namespace std;
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define ull unsigned long long
bool solve (){
int n, m;
cin >> n >> m;
char a[n][m];
forn(i, n){
forn (j, m){
cin >> a[i][j];
}
}
string target = "vika";
bool result = false;
int k = 0;
forn(j, m){
forn(i, n){
if (target[k] == a[i][j]){
k++;
if(k==4){
return true;
}
break;
}
}
}
return result;
}
int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
ull t;
cin >> t;
while(t--) {
cout << (solve() ? "Yes" :"No") << "\n";
}
return 0;
}