結果

問題 No.1292 パタパタ三角形
ユーザー FF256grhyFF256grhy
提出日時 2020-11-21 19:05:49
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 508 bytes
コンパイル時間 2,153 ms
コンパイル使用メモリ 208,752 KB
実行使用メモリ 15,988 KB
最終ジャッジ日時 2023-09-30 22:12:24
合計ジャッジ時間 3,575 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 58 ms
5,832 KB
testcase_08 AC 56 ms
5,924 KB
testcase_09 AC 80 ms
15,316 KB
testcase_10 AC 82 ms
15,136 KB
testcase_11 AC 85 ms
15,232 KB
testcase_12 AC 84 ms
15,988 KB
testcase_13 AC 85 ms
15,872 KB
testcase_14 AC 20 ms
4,376 KB
testcase_15 AC 20 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;
	P a = { 0, 0 }, b = { 1, 0 }, c = { 0, 1 };
	set<T> se = { { a, b, c } };
	for(auto e: s) {
		if(e == 'a') { a = b + c - a; }
		if(e == 'b') { b = c + a - b; }
		if(e == 'c') { c = a + b - c; }
		se.insert({ a, b, c });
	}
	cout << se.size() << endl;
}
0