-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrple.cpp
More file actions
33 lines (31 loc) · 691 Bytes
/
rple.cpp
File metadata and controls
33 lines (31 loc) · 691 Bytes
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
#include <iostream>
#include <algorithm>
#include <set>
using namespace std;
int main() {
freopen("input.txt", "r", stdin);
int test_cases, n, r, a, b;
bool flagged;
set <int> spy, civil;
set <int> :: iterator it;
cin >> test_cases;
for (int i=1; i<=test_cases; i++) {
spy.clear();
civil.clear();
flagged = false;
cin >> n >> r;
for (int j=0; j<r; j++) {
cin >> a >> b;
spy.insert(a);
civil.insert(b);
}
for (it = spy.begin(); it != spy.end(); it++)
if (find(civil.begin(), civil.end(), *it) != civil.end())
flagged = true;
cout << "Scenario #" << i << ": ";
if (flagged)
cout << "spied" << endl;
else cout << "spying" << endl;
}
return 0;
}