結果

問題 No.601 Midpoint Erase
ユーザー aaaaaa
提出日時 2018-09-15 10:36:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,875 bytes
コンパイル時間 1,182 ms
コンパイル使用メモリ 101,920 KB
実行使用メモリ 8,360 KB
最終ジャッジ日時 2023-09-22 22:53:30
合計ジャッジ時間 11,133 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 923 ms
6,404 KB
testcase_04 AC 1,189 ms
7,692 KB
testcase_05 AC 602 ms
6,032 KB
testcase_06 AC 197 ms
4,580 KB
testcase_07 AC 1,074 ms
8,108 KB
testcase_08 AC 793 ms
6,328 KB
testcase_09 AC 1,138 ms
7,748 KB
testcase_10 AC 64 ms
4,380 KB
testcase_11 TLE -
testcase_12 AC 488 ms
5,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 1 ms
4,384 KB
testcase_25 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>

using namespace std;

int main() {
	int i, j, k;
	int n;
	vector<vector<long>>xy, xyki, xygu(0, vector<long>(2));

	cin >> n;

	for (i = 0; i < n; i++) {
		long num1, num2;
		cin >> num1 >> num2;
		if (num1 % 2 == 0 && num2 % 2 == 0) {
			xygu.push_back({ num1, num2 });
		}
		else if (num1 % 2 == 1 && num2 % 2 == 1) {
			xyki.push_back({ num1, num2 });
		}
		else {
			xy.push_back({ num1,num2 });
		}
	}

	int cnt = 0;

	if (xygu.size() > 0) {
		cnt += xygu.size() / 2;
	}
	if (xyki.size() > 0) {
		cnt += xyki.size() / 2;
	}


	bool flag = false; //falseはアリス

	if (cnt > 0) {
		if (cnt % 2 == 0) {
			flag = false;
		}
		else if(cnt%2==1){
			flag = true;
		}
	}
	

	while (true)
	{
		bool flag2 = false;


		for (i = 0; i < xy.size(); i++) {
			long numx = xy[i][0];
			long numy = xy[i][1];
			for (j = i+1; j < xy.size(); j++) {
				if (i == j)continue;
				if (abs(xy[j][0] - numx) >= 1 && abs(xy[j][1] - numy) >= 1 && abs(xy[j][0] - numx) % 2 == 0 && abs(xy[j][1] - numy) % 2 == 0) {
					if (flag == false) { flag = true; }
					else if (flag == true) { flag = false; }

					flag2 = true;
					cnt++;

					if (i > j) {
						xy.erase(xy.begin() + i);
						xy.erase(xy.begin() + j);
					}
					else {
						xy.erase(xy.begin() + j);
						xy.erase(xy.begin() + i);
					}
					break;
				}
			}
			if (flag2 == true) break;
		}

		if (flag2 == false) break;
	}

	if (cnt == 0) {
		cout << "Bob" << endl;
	}
	else if (flag == true) {
		cout << "Alice" << endl;
	}
	else {
		cout << "Bob" << endl;
	}







	getchar();
	getchar();
	return 0;
}
0