-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patholliePS-404.cpp
75 lines (72 loc) · 1.39 KB
/
olliePS-404.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ull unsigned long long
#define flash() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const long long int MOD = 1e9 + 7;
const long long int INF = 1e18;
const long long int MAX = 1e9;
void Solution(ll T)
{
ll q;
cin >> q;
map<char , ll> mps , mpt;
mps['a']++;
mpt['a']++;
for(ll i = 1 ; i <= q ; i++)
{
ll d , k;
string str;
cin >> d >> k >> str;
if(d == 1)
{
for(auto it : str)
{
mps[it] += k;
}
}
else
{
for(auto it : str)
{
mpt[it] += k;
}
}
if(mps.size() == 1 && mpt.size() == 1)
{
if(mps['a'] >= mpt['a'])
{
cout << "NO" << endl;
}
else
{
cout << "YES" << endl;
}
}
else if(mps.size() == 1 && mpt.size() > 1)
{
cout << "YES" << endl;
}
else if(mps.size() > 1 && mpt.size() == 1)
{
cout << "NO" << endl;
}
else
{
cout << "YES" << endl;
}
}
}
int main()
{
flash();
ll tc;
cin >> tc;
ll t = 1;
while(t <= tc)
{
Solution(t);
t++;
}
return 0;
}