@MuntahaIslam/

# P2493

## URI Problem 2493 solution.

Files
• main.cpp
main.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
```
```#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {

int n;

while(scanf_s("%d" , &n) != EOF) {

int testCases = n;
while(testCases > 0) {

int i = 0;
string arr[n];

while (i < n) {

string solution;

int firstValue, secondValue, thirdValue;
scanf_s("%s %s=%s", &firstValue, &secondValue, &thirdValue);

if(firstValue + secondValue == thirdValue) solution = "+";
else if(firstValue - secondValue == thirdValue) solution = "-";
else solution = "*";

arr[i] = solution;

i++;
}

int j = 0;
vector<string> rightPeople;

int k = 0;
while (j < n) {

int questionNumber;
string name, operatorName;
scanf_s("%s %s %s", &name, &questionNumber, &operatorName);

if(arr[questionNumber] == operatorName) rightPeople.assign(k++, name);

i++;
}

if(rightPeople.size() == n) cout << "You Shall All Pass!" << endl;
else if(rightPeople.empty()) cout << "None Shall Pass!" << endl;
else {

sort(rightPeople.begin(), rightPeople.end());

for (auto const& item: rightPeople) {
std::cout << item << " ";
}
}

--testCases;
}
}
}```