結果

問題 No.1717 Levi-Civita Triangle
ユーザー nok0nok0
提出日時 2021-09-17 22:27:57
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 848 bytes
コンパイル時間 2,022 ms
コンパイル使用メモリ 209,728 KB
実行使用メモリ 9,132 KB
最終ジャッジ日時 2023-10-24 11:28:52
合計ジャッジ時間 3,939 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 6 ms
4,348 KB
testcase_07 AC 26 ms
5,992 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 6 ms
4,348 KB
testcase_12 AC 17 ms
5,600 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 5 ms
4,348 KB
testcase_17 AC 41 ms
8,756 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 5 ms
4,348 KB
testcase_22 AC 26 ms
5,952 KB
testcase_23 AC 1 ms
4,348 KB
testcase_24 AC 1 ms
4,348 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 AC 2 ms
4,348 KB
testcase_27 AC 12 ms
4,772 KB
testcase_28 AC 2 ms
4,348 KB
testcase_29 AC 1 ms
4,348 KB
testcase_30 AC 2 ms
4,348 KB
testcase_31 AC 4 ms
4,348 KB
testcase_32 AC 39 ms
8,836 KB
testcase_33 AC 52 ms
9,132 KB
testcase_34 AC 52 ms
9,132 KB
testcase_35 AC 45 ms
9,132 KB
testcase_36 AC 46 ms
9,132 KB
testcase_37 AC 48 ms
9,132 KB
testcase_38 AC 48 ms
9,132 KB
testcase_39 AC 52 ms
9,132 KB
testcase_40 AC 51 ms
9,132 KB
testcase_41 AC 46 ms
9,132 KB
testcase_42 AC 46 ms
9,132 KB
testcase_43 AC 47 ms
9,132 KB
testcase_44 AC 48 ms
9,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin >> n;
	auto levi_civita = [](int x, int y, int z) {
		if(x == y or y == z or z == x) return 0;
		if(vector{x, y, z} == vector{0, 1, 2}) return 1;
		if(vector{x, y, z} == vector{1, 2, 0}) return 1;
		if(vector{x, y, z} == vector{2, 0, 1}) return 1;
		return 2;
	};
	vector a(n * 2 + 1, 0), b(0, 0);
	for(auto &v : a) cin >> v;
	for(int i = 0; i < n * 2 - 1; i++) {
		b.push_back(levi_civita(a[i], a[i + 1], a[i + 2]));
	}
	auto mul2 = [](auto &vec) {
		auto ret = vec;
		for(auto &v : vec) ret.push_back(v);
		vec = ret;
	};
	vector one{2, 0, 1, 0}, two{1, 0, 2, 0};
	if(n % 2) swap(one, two);
	while(one.size() < b.size()) mul2(one);
	one.resize(b.size());
	while(two.size() < b.size()) mul2(two);
	two.resize(b.size());
	cout << (b == one ? 1 : b == two ? 2 : 0) << endl;
}
0