結果

問題 No.1292 パタパタ三角形
ユーザー ninoinui
提出日時 2020-11-21 09:51:41
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 467 bytes
コンパイル時間 2,046 ms
コンパイル使用メモリ 199,312 KB
最終ジャッジ日時 2025-01-16 03:51:28
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 2 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
  string S;
  cin >> S;
  set<pair<int, int>> SE;
  SE.insert({0, 0});
  for (int i = 0, f = 0, a = 0, b = 1, c = 2, x = 0, y = 0, t; i < S.size(); i++, f ^= 1) {
    if (S[i] == 'a') (f) ? SE.insert({x, ++y}) : SE.insert({x, --y});
    if (S[i] == 'b') SE.insert({--x, y}), t = a, a = c, c = b, b = t;
    if (S[i] == 'c') SE.insert({++x, y}), t = a, a = b, b = c, c = t;
  }
  cout << SE.size() << "\n";
}
0