| 3 | using namespace std; |
| 4 | |
| 5 | int main() |
| 6 | { |
| 7 | #ifndef ONLINE_JUDGE //For testing using input and output files |
| 8 | freopen("ip.txt", "r", stdin); |
| 9 | freopen("op.txt", "w", stdout); |
| 10 | #endif |
| 11 | |
| 12 | ios::sync_with_stdio(0); //For faster input/output |
| 13 | cin.tie(0); |
| 14 | cout.tie(0); |
| 15 | |
| 16 | ll t; |
| 17 | cin >> t; |
| 18 | while(t--) |
| 19 | { |
| 20 | // Type your code here... |
| 21 | ll n, m; |
| 22 | cin >> n >> m; |
| 23 | ll sum = n + m; //Here we create a map, whose keys would be grades of |
| 24 | map <ll, ll> cmap; //students inside of the class and values would be |
| 25 | while (n--) //no. of students having that grade |
| 26 | { |
| 27 | ll ai; //Entering grades of students PRESENT INSIDE THE CLASS |
| 28 | cin >> ai; |
| 29 | cmap[ai]++; |
| 30 | } |
| 31 | while (m--) |
| 32 | { |
| 33 | ll ai; //Entering grades of students ABOUT TO ENTER THE CLASS |
| 34 | cin >> ai; |
| 35 | auto it = cmap.find(ai); |
| 36 | if(it == cmap.end()) //If student with entered grade is not present inside |
| 37 | { //the map(class), s/he will not it. |
| 38 | cout << "NO\n"; |
| 39 | } |
| 40 | else //Otherwise, s/he will enter. |
| 41 | { |
| 42 | cout << "YES\n"; |
| 43 | } |
| 44 | cmap[ai]++; |
| 45 | } |
| 46 | |
| 47 | |
| 48 | } |
| 49 | return 0; |
| 50 | } |
nothing calls this directly
no outgoing calls
no test coverage detected