結果

問題 No.571 3人兄弟(その2)
ユーザー ミドリムシミドリムシ
提出日時 2017-10-28 11:47:13
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 2,549 bytes
コンパイル時間 599 ms
コンパイル使用メモリ 63,556 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-01 20:36:33
合計ジャッジ時間 1,137 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1 ms
6,940 KB
testcase_11 AC 1 ms
6,944 KB
testcase_12 WA -
testcase_13 AC 1 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;

int main(){
    int H[3], W[3];
    string alphabets[3] = {"A", "B", "C"};
    for(int i = 0; i < 3; i++){
        cin >> H[i] >> W[i];
    }
    int H_tmp[3];
    for(int i = 0; i < 3; i++){
        H_tmp[i] = H[i];
    }
    sort(H_tmp, H_tmp + 3, greater<int>());
    if(H_tmp[0] == H_tmp[1] && H_tmp[1] == H_tmp[2]){
        int W_tmp[3];
        for(int i = 0; i < 3; i++){
            W_tmp[i] = W[i];
        }
        sort(W_tmp, W_tmp + 3);
        for(int i = 0; i < 3; i++){
            for(int j = 0; j < 3; j++){
                if(W_tmp[i] == W[j]){
                    cout << alphabets[j] << endl;
                    break;
                }
            }
        }
    }else if(H_tmp[0] == H_tmp[1]){
        int W_tmp[2];
        for(int i = 0; i < 3; i++){
            if(H_tmp[2] == H[i]){
                int j_count = 0;
                for(int j = 0; j < 3; j++){
                    if(i != j){
                        W_tmp[j_count] = W[j];
                        j_count++;
                    }
                }
                break;
            }
        }
        sort(W_tmp, W_tmp + 2);
        for(int i = 0; i < 2; i++){
            for(int j = 0; j < 3; j++){
                if(W_tmp[i] == W[j]){
                    cout << alphabets[j] << endl;
                    break;
                }
            }
        }
        for(int i = 0; i < 3; i++){
            if(H_tmp[2] == H[i]){
                cout << alphabets[i] << endl;
                break;
            }
        }
    }else if(H_tmp[1] == H_tmp[2]){
        int W_tmp[2];
        for(int i = 0; i < 3; i++){
            if(H_tmp[0] == H[i]){
                cout << alphabets[i] << endl;
                int j_count = 0;
                for(int j = 0; j < 3; j++){
                    if(i != j){
                        W_tmp[j_count] = W[j];
                        j_count++;
                    }
                }
                break;
            }
        }
        sort(W_tmp, W_tmp + 2);
        for(int i = 0; i < 2; i++){
            for(int j = 0; j < 3; j++){
                if(W_tmp[i] == W[j]){
                    cout << alphabets[j] << endl;
                    break;
                }
            }
        }
     }else{
        for(int i = 0; i < 3; i++){
            for(int j = 0; j < 3; j++){
                if(H_tmp[i] == H[j]){
                    cout << alphabets[j] << endl;
                    break;
                }
            }
        }
    }
}
0