Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: rice_ot

Problemset: HR

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-17 10:37:37

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

struct player{
    string name;
    int atk;
    int def;
    int spd;
};

bool compare(int a, int b){
    return a > b;
}

bool comNiga(string a, string b){
    for(int i = 0; i<2; i++){
        if(a[i]!=b[i]) return a<b;
    }
    return false;
}

bool comString(string a, string b){
    for(int i = 0; i<2; i++){
        if(a[i]!=b[i]) return true;
    }
    return false;
}

int main(){
    struct player p1, p2;
    cin>>p1.name>>p2.name;
    cin>>p1.atk>>p1.def>>p1.spd;
    cin>>p2.atk>>p2.def>>p2.spd;
    int t1 = p1.atk+p1.def+p1.spd;
    int t2 = p2.atk+p2.def+p2.spd;
    if(t1!= t2){
        cout<<"Win: "<<(compare(t1, t2) ? p1.name : p2.name);
    }
    else{
        int r1 = p1.name.length();
        int r2 = p2.name.length();
        if(p1.atk != p2.atk) cout<<"Win: "<<(compare(p1.atk, p2.atk) ? p1.name : p2.name);
        else if(p1.spd != p2.spd) cout<<"Win: "<<(compare(p1.spd, p2.spd) ? p1.name : p2.name);
        else if(p1.name[2] != p2.name[2] && ( p1.name[2] == '3' || p2.name[2] =='3') ) cout<<"Win: "<<((p1.name[2] == '3') ? p1.name : p2.name);
        else if( (p1.name[r1-1] == '1' && p1.name[r1-2] == '2' || p2.name[r2-1] == '1' && p2.name[r2-2] == '2') && p1.name[r1-1] != p2.name[r2-1]) cout<<"Win: "<<((p1.name[r1-1] == '1') ? p1.name : p2.name);
        else if(comString(p1.name, p2.name)) cout<<"Win: "<<(comNiga(p1.name, p2.name) ? p1.name : p2.name);
        else cout<<"No one.";
        
    }
    
    
}