K3MVM - Editorial

PROBLEM LINK: ME VS ME

Author: Soumy Jain
Tester: Divyank Goyal
Editorialist: Soumy Jain

DIFFICULTY:

EASY-MEDIUM

PREREQUISITES:

String Comparison

EXPLANATION:

Both of them will try to maximize their turns, so they will take only 1 item per turn. Hence y_{1} and y_{2} become useless.

Now the question arises how to compare integer values of magnitude up to 10^{1000}.

Directly we can compare them by length, the greater the length the greater is the number.

If both have the same length we can compare them starting from right to left or using operators.

SOLUTIONS:

Setter's Solution
#include <bits/stdc++.h>
#define ll long long
using namespace std;

void compare(string &s, string &t)
{
    if (s.length() > t.length())
        cout << "Soumy-Sigma\n";
    else if (t.length() > s.length())
        cout << "Soumy-Beta\n";
    else if (s > t)
        cout << "Soumy-Sigma\n";
    else
        cout << "Soumy-Beta\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    cin >> t;
    while (t--)
    {
        string x1, x2, y1, y2;
        cin >> x1 >> x2 >> y1 >> y2;
        compare(x1, x2);
    }
    return 0;
}