알고리즘

[알고리즘] 백준 1524 - 세준세비 (C++)

blueberrysoda 2024. 12. 7. 23:55

[문제 링크] : https://www.acmicpc.net/problem/1524

#include <iostream>
using namespace std;
 
int main(){
    int T, N, M, inp;
    cin >> T;
    while(T--){
        int a = 0, b = 0;
        cin >> N >> M;

        while(N--){
            cin >> inp; 
            a = max(a, inp);
        }

        while(M--){
            cin >> inp;
            b = max(b, inp);
        }

        if(a >= b){
            cout << "S\n";
        }
        else if(b > a){
            cout << "B\n";
        }
    }
    return 0;
}