結果

問題 No.946 箱箱箱
ユーザー ianCKianCK
提出日時 2019-12-09 07:09:21
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 784 bytes
コンパイル時間 1,383 ms
コンパイル使用メモリ 49,368 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-09 10:10:37
合計ジャッジ時間 6,959 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 88 ms
4,376 KB
testcase_04 AC 96 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 95 ms
4,376 KB
testcase_07 AC 94 ms
4,376 KB
testcase_08 AC 96 ms
4,380 KB
testcase_09 AC 36 ms
4,380 KB
testcase_10 AC 89 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 22 ms
4,380 KB
testcase_13 AC 96 ms
4,376 KB
testcase_14 AC 95 ms
4,380 KB
testcase_15 AC 91 ms
4,384 KB
testcase_16 AC 85 ms
4,380 KB
testcase_17 AC 88 ms
4,376 KB
testcase_18 AC 94 ms
4,380 KB
testcase_19 AC 72 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 50 ms
4,380 KB
testcase_22 AC 92 ms
4,376 KB
testcase_23 AC 94 ms
4,376 KB
testcase_24 AC 50 ms
4,380 KB
testcase_25 AC 67 ms
4,384 KB
testcase_26 AC 88 ms
4,376 KB
testcase_27 AC 90 ms
4,380 KB
testcase_28 AC 86 ms
4,380 KB
testcase_29 AC 96 ms
4,376 KB
testcase_30 AC 94 ms
4,380 KB
testcase_31 AC 93 ms
4,380 KB
testcase_32 AC 87 ms
4,380 KB
testcase_33 AC 93 ms
4,376 KB
testcase_34 AC 95 ms
4,376 KB
testcase_35 AC 93 ms
4,384 KB
testcase_36 AC 96 ms
4,380 KB
testcase_37 AC 96 ms
4,376 KB
testcase_38 AC 67 ms
4,380 KB
testcase_39 AC 89 ms
4,380 KB
testcase_40 AC 60 ms
4,380 KB
testcase_41 AC 90 ms
4,376 KB
testcase_42 AC 92 ms
4,380 KB
testcase_43 AC 95 ms
4,380 KB
testcase_44 AC 67 ms
4,376 KB
testcase_45 AC 96 ms
4,380 KB
testcase_46 AC 95 ms
4,380 KB
testcase_47 AC 2 ms
4,380 KB
testcase_48 AC 1 ms
4,380 KB
testcase_49 AC 1 ms
4,380 KB
testcase_50 AC 1 ms
4,380 KB
testcase_51 AC 2 ms
4,376 KB
testcase_52 AC 2 ms
4,384 KB
testcase_53 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
#define PB push_back
constexpr int kN = int(1E5 + 10);

int a[kN], x[kN], ans[kN];

int main() {
	int n, sz;
	vector<int> tmp;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
	x[0] = 0;
	for (int i = 1; i <= n; i++) x[i] = x[i - 1] ^ a[i];
	ans[n + 1] = 0;
	for (int i = n; i >= 1; i--) {
		tmp.clear();
		for (int j = i; j <= n; j++) tmp.PB(x[j] ^ x[i - 1] ^ ans[j + 1]);
		sort(tmp.begin(), tmp.end());
		tmp.resize(unique(tmp.begin(), tmp.end()) - tmp.begin());
		sz = int(tmp.size());
		if (tmp.back() == sz - 1) ans[i] = sz;
		else for (int j = 0; j < sz; j++) if (tmp[j] != j) {
			ans[i] = j;
			break;
		}
	}

	if (ans[1]) printf("Takahashi\n");
	else printf("Takanashi\n");
}
0