結果
問題 | No.1292 パタパタ三角形 |
ユーザー |
![]() |
提出日時 | 2020-11-21 18:52:06 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 73 ms / 2,000 ms |
コード長 | 496 bytes |
コンパイル時間 | 2,429 ms |
コンパイル使用メモリ | 200,224 KB |
最終ジャッジ日時 | 2025-01-16 04:06:52 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 |
ソースコード
#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; }