Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define cin(vec) for(auto& i : vec) cin >> i
- #define cin_2d(vec, n, m) for(int i = 0; i < n; i++) for(int j = 0; j < m && cin >> vec[i][j]; j++);
- #define cout(vec) for(auto& i : vec) cout << i << " "; cout << "\n";
- #define cout_2d(vec, n, m) for(int i = 0; i < n; i++, cout << "\n") for(int j = 0; j < m && cout << vec[i][j] << " "; j++);
- #define cout_map(mp) for(auto& [f, s] : mp) cout << f << " " << s << "\n";
- #define fixed(n) cout << fixed << setprecision(n)
- #define Ceil(n, m) (((n) / (m)) + ((n) % (m) ? 1 : 0))
- #define fill(vec, value) memset(vec, value, sizeof(vec));
- #define Num_of_Digits(n) ((int)log10(n)+1)
- #define all(vec) vec.begin(),vec.end()
- #define rall(vec) vec.rbegin(),vec.rend()
- #define sz(x) int(x.size())
- #define fi first
- #define se second
- #define Pair pair < int, int >
- #define ll long long
- #define ull unsigned long long
- #define Mod 1'000'000'007
- #define INF 2'000'000'000
- #define all(vec) vec.begin(),vec.end()
- #define rall(vec) vec.rbegin(),vec.rend()
- #define sz(x) int(x.size())
- #define fi first
- #define se second
- #define Pair pair < int, int >
- #define ll long long
- #define ull unsigned long long
- #define Mod 1'000'000'007
- #define INF 2'000'000'000
- #define PI acos(-1)
- void Code_Crush(){
- ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
- #endif
- }
- int main(){
- Code_Crush();
- int n, m, count;
- cin >> n;
- string room, name, dead, sus_room;
- for(int i = 0; i < n && cin >> room; i++);
- cin >> m;
- vector < pair < string, string > > vent(m);
- for(auto& [f, s] : vent) cin >> f >> s;
- cin >> count;
- int reports = count - 3;
- map < string, int > sus;
- for(int i = 0; i < count && cin >> name; i++)sus[name];
- while(reports--){
- cin >> dead >> room;
- sus.erase(dead);
- count--;
- for(int i = 0; i < count; i++){
- cin >> name >> sus_room;
- bool is_sus = (room == sus_room);
- for(auto & [f, s] : vent)
- if((f == sus_room && s == room) || (f == room && s == sus_room)) is_sus = true;
- if(is_sus) sus[name]++;
- }
- }
- int mx_cnt = -1;
- for(auto & [f, s] : sus){
- if(s > mx_cnt) name = f, mx_cnt = s;
- else if(s == mx_cnt) name = "?";
- }
- cout << name << "\n";
- return 0;
- }
Add Comment
Please, Sign In to add comment