結果

問題 No.571 3人兄弟(その2)
ユーザー newlife171128newlife171128
提出日時 2017-12-15 23:31:42
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 4,709 bytes
コンパイル時間 859 ms
コンパイル使用メモリ 92,564 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-14 16:02:50
合計ジャッジ時間 1,422 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <sstream>
#include<sstream>
#include <queue>
#include <limits>
#include <cstdlib>
#include <deque>
#include <map>
#include <set>
#include <iomanip>
using namespace std;

int main() {

	vector<pair<int, int> > height_weight;

	pair<int, int> a;
	pair<int, int> b;
	pair<int, int> c;

	int first = 0;
	int second = 0;
	int mozi[1000];
	cin >> first >> second;
	a = make_pair(first, second);
	mozi[a.first * 2 + a.second] = 0;

	cin >> first >> second;
	b = make_pair(first, second);
	mozi[b.first * 2 + b.second] = 1;

	cin >> first >> second;
	c = make_pair(first, second);
	mozi[c.first * 2 + c.second] = 2;

	height_weight.push_back(a);
	height_weight.push_back(b);
	height_weight.push_back(c);

	sort(height_weight.begin(), height_weight.end(),
			greater<pair<int, int> >());

/*
	cout << height_weight[0].second << height_weight[1].second
			<< height_weight[2].second << endl;
*/

	if (height_weight[0].first == height_weight[1].first
			&& height_weight[1].first == height_weight[2].first) {
		if (mozi[height_weight[2].first * 2 + height_weight[2].second] == 0) {
			cout << "A" << endl;
		} else if (mozi[height_weight[2].first * 2 + height_weight[2].second]
				== 1) {
			cout << "B" << endl;
		} else {
			cout << "C" << endl;
		}
		if (mozi[height_weight[1].first * 2 + height_weight[1].second] == 0) {
			cout << "A" << endl;
		} else if (mozi[height_weight[1].first * 2 + height_weight[1].second]
				== 1) {
			cout << "B" << endl;
		} else {
			cout << "C" << endl;
		}
		if (mozi[height_weight[0].first * 2 + height_weight[0].second] == 0) {
			cout << "A" << endl;
		} else if (mozi[height_weight[0].first * 2 + height_weight[0].second]
				== 1) {
			cout << "B" << endl;
		} else {
			cout << "C" << endl;
		}
		return 0;
	}

	if (height_weight[0].first == height_weight[1].first) {
		if (height_weight[0].second > height_weight[1].second) {
			if (mozi[height_weight[1].first * 2 + height_weight[1].second]
					== 0) {
				cout << "A" << endl;
			} else if (mozi[height_weight[1].first * 2 + height_weight[1].second]
					== 1) {
				cout << "B" << endl;
			} else {
				cout << "C" << endl;
			}

			if (mozi[height_weight[0].first * 2 + height_weight[0].second]
					== 0) {
				cout << "A" << endl;
			} else if (mozi[height_weight[0].first * 2 + height_weight[0].second]
					== 1) {
				cout << "B" << endl;
			} else {
				cout << "C" << endl;
			}

			if (mozi[height_weight[2].first * 2 + height_weight[2].second]
					== 0) {
				cout << "A" << endl;
			} else if (mozi[height_weight[2].first * 2 + height_weight[2].second]
					== 1) {
				cout << "B" << endl;
			} else {
				cout << "C" << endl;
			}
			return 0;
		}
	} else {
		if (mozi[height_weight[0].first * 2 + height_weight[0].second] == 0) {
			cout << "A" << endl;
		} else if (mozi[height_weight[0].first * 2 + height_weight[0].second]
				== 1) {
			cout << "B" << endl;
		} else {
			cout << "C" << endl;
		}
	}

	if (height_weight[1].first == height_weight[2].first) {
		if (height_weight[1].second > height_weight[2].second) {
			if (mozi[height_weight[2].first * 2 + height_weight[2].second]
					== 0) {
				cout << "A" << endl;
			} else if (mozi[height_weight[2].first * 2 + height_weight[2].second]
					== 1) {
				cout << "B" << endl;
			} else {
				cout << "C" << endl;
			}

			if (mozi[height_weight[1].first * 2 + height_weight[1].second]
					== 0) {
				cout << "A" << endl;
			} else if (mozi[height_weight[1].first * 2 + height_weight[1].second]
					== 1) {
				cout << "B" << endl;
			} else {
				cout << "C" << endl;
			}
		} else {
			if (mozi[height_weight[1].first * 2 + height_weight[1].second]
					== 0) {
				cout << "A" << endl;
			} else if (mozi[height_weight[1].first * 2 + height_weight[1].second]
					== 1) {
				cout << "B" << endl;
			} else {
				cout << "C" << endl;
			}

			if (mozi[height_weight[2].first * 2 + height_weight[2].second]
					== 0) {
				cout << "A" << endl;
			} else if (mozi[height_weight[2].first * 2 + height_weight[2].second]
					== 1) {
				cout << "B" << endl;
			} else {
				cout << "C" << endl;
			}
		}
	} else {
		if (mozi[height_weight[1].first * 2 + height_weight[1].second] == 0) {
			cout << "A" << endl;
		} else if (mozi[height_weight[1].first * 2 + height_weight[1].second]
				== 1) {
			cout << "B" << endl;
		} else {
			cout << "C" << endl;
		}

		if (mozi[height_weight[2].first * 2 + height_weight[2].second] == 0) {
			cout << "A" << endl;
		} else if (mozi[height_weight[2].first * 2 + height_weight[2].second]
				== 1) {
			cout << "B" << endl;
		} else {
			cout << "C" << endl;
		}
	}

	return 0;
}
0