aboutsummaryrefslogtreecommitdiff
path: root/codechef/HiringTest/main.cpp
blob: e5a08a86cf90c89724b5ce21b1fd543429e8c238 (plain)
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
#include<bits/stdc++.h>

using namespace std;

int main () {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int tt;
	cin >> tt;
	while(tt--){
    int n, m, x, y;
    cin >> n >> m >> x >> y;
    string ans = "";
    for(int i = 0; i < n; i++) {
      string pb;
      cin >> pb;
      int f = count(pb.begin(), pb.end(), 'F');
      int p = count(pb.begin(), pb.end(), 'P');
      if(f >= x || f == x - 1 && p >= y) {
        ans.push_back('1');
      } else {
        ans.push_back('0');
      }
    }
    cout << ans << endl;
	}
}