Submission
Status:
P---PPPP--
Subtask/Task Score:
50/100
Score: 50
User: cyblox_boi
Problemset: HR
Language: cpp
Time: 0.003 second
Submitted On: 2025-12-29 22:03:17
#include <bits/stdc++.h>
using namespace std;
struct Player
{
string id;
int attack;
int defense;
int speed;
bool operator>(const Player &other) const
{
if (attack != other.attack)
{
return attack > other.attack;
}
if (speed != other.speed)
{
return speed > other.speed;
}
throw string("Attack == Speed");
}
};
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
vector<Player> players(2);
for (int i = 0; i < 2; i++)
{
cin >> players[i].id;
}
for (int i = 0; i < 2; i++)
{
cin >> players[i].attack >> players[i].defense >> players[i].speed;
}
string winner;
try
{
sort(players.begin(), players.end(), greater<Player>());
winner = players[0].id;
}
catch (const string &errorMessage)
{
int foundIndex = -1;
int n = players.size();
for (int i = 0; i < n; i++)
{
string &id = players[i].id;
if (id[0] == '3')
{
if (foundIndex != -1)
{
foundIndex = -2;
break;
}
foundIndex = i;
}
}
if (foundIndex == -2)
{
foundIndex = -1;
for (int i = 0; i < n; i++)
{
string &id = players[i].id;
if (id[n - 2] == '2' && id[n - 1] == '1')
{
if (foundIndex != -1)
{
foundIndex = -2;
break;
}
foundIndex = i;
}
}
if (foundIndex == -2)
{
foundIndex = -1;
for (int i = 0; i < 10; i++)
{
if (players[0].id[i] != players[1].id[i])
{
if (players[0].id[i] - '0' > players[1].id[i])
{
foundIndex = 0;
}
else
{
foundIndex = 1;
}
break;
}
}
}
}
winner = players[foundIndex].id;
}
if (!winner.empty())
{
cout << "Win: " << winner;
}
else
{
cout << "No one.";
}
cout << '\n';
return 0;
}