結果

問題 No.1292 パタパタ三角形
ユーザー FF256grhyFF256grhy
提出日時 2020-11-21 18:52:06
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 496 bytes
コンパイル時間 3,046 ms
コンパイル使用メモリ 209,112 KB
実行使用メモリ 15,940 KB
最終ジャッジ日時 2023-09-30 22:11:06
合計ジャッジ時間 3,621 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,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,384 KB
testcase_07 AC 60 ms
6,100 KB
testcase_08 AC 58 ms
5,852 KB
testcase_09 AC 81 ms
15,328 KB
testcase_10 AC 81 ms
15,264 KB
testcase_11 AC 86 ms
15,132 KB
testcase_12 AC 84 ms
15,876 KB
testcase_13 AC 84 ms
15,940 KB
testcase_14 AC 20 ms
4,380 KB
testcase_15 AC 19 ms
4,380 KB
testcase_16 AC 24 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using P = array<int, 2>;
using T = array<P, 3>;
P operator+(P a, P b) { return { a[0] + b[0], a[1] + b[1] }; }
P operator-(P a, P b) { return { a[0] - b[0], a[1] - b[1] }; }
int main() {
	string s; cin >> s;
	T t = { 0, 0, 1, 0, 0, 1 };
	set<T> se = { t };
	for(auto e: s) {
		auto & [a, b, c] = t;
		if(e == 'a') { a = b + c - a; }
		if(e == 'b') { b = c + a - b; }
		if(e == 'c') { c = a + b - c; }
		se.insert(t);
	}
	cout << se.size() << endl;
}
0