Click Here to go back to the homepage.

Army Strength (Easy) Solution:


#include <bits/stdc++.h>
using namespace std;

std::vector<std::string> string_split(const std::string &s, const string &delimiter=" "){
    std::vector<std::string> tokens;
    std::string token;
    size_t pos = 0, prev = 0, delim_length = delimiter.length();
    while ((pos = s.find(delimiter, pos)) != std::string::npos){
        token = s.substr(prev, pos - prev);
        if(!token.empty()){
            tokens.push_back(token);
        }
        prev = pos += delim_length;
    }
    tokens.push_back(s.substr(prev, pos));
    return tokens;
}

int main() {
    // #ifndef TESTING
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif
    
    string line;
    getline(cin, line);
    int cases = stoi(line);
    while(cases--){
        getline(cin, line);
        getline(cin, line);
        getline(cin, line);
        auto v = string_split(line);
        vector<int> converted;
        transform(v.begin(), v.end(), back_inserter(converted), [](const string &s){ return stoi(s); });
        int g_max = *(max_element(converted.begin(), converted.end()));
        getline(cin, line);
        v.clear();
        v = string_split(line);
        transform(v.begin(), v.end(), back_inserter(converted), [](const string &s){ return stoi(s); });
        int m_max = *(max_element(converted.begin(), converted.end()));
        if(g_max >= m_max){
            cout << "Godzilla" << endl;
        } else {
            cout << "MechaGodzilla" << endl;
        }
    }

    return 0;
}