結果

問題 No.1292 パタパタ三角形
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2020-11-20 21:54:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,040 bytes
コンパイル時間 1,537 ms
コンパイル使用メモリ 171,228 KB
実行使用メモリ 12,812 KB
最終ジャッジ日時 2023-09-30 19:10:22
合計ジャッジ時間 2,690 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 64 ms
12,812 KB
testcase_13 AC 71 ms
12,800 KB
testcase_14 AC 7 ms
4,376 KB
testcase_15 AC 7 ms
4,376 KB
testcase_16 AC 8 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2020.11.20 21:54:03
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

int main() {
    string s;cin >> s;
    int n = s.size();
    set<pair<int,int>> st;
    int ans = 0;
    int now_x = 200000, now_y = 200000;
    st.insert({now_x,now_y});
    for (int i = 0; i < n; i++) {
        if (now_x % 2 == 0 && now_y % 3 == 0) {
            if (s[i] == 'a') {
                now_y++;
            }
            else if (s[i] == 'b') {
                now_x--;
            }
            else {
                now_y--;
            }
        }
        else if (now_x % 2 == 0 && now_y % 3 == 1) {
            if (s[i] == 'a') {
                now_y--;
            }
            else if (s[i] == 'b') {
                now_y++;
            }
            else {
                now_x++;
            }
        }
        else if (now_x % 2 == 0 && now_y % 3 == 2) {
            if (s[i] == 'a') {
                now_x--;
            }
            else if (s[i] == 'b') {
                now_y--;
            }
            else {
                now_y++;
            }
        }
        else if (now_x % 2 == 1 && now_y % 3 == 0) {
            if (s[i] == 'a') {
                now_y++;
            }
            else if (s[i] == 'b') {
                now_x++;
            }
            else {
                now_y--;
            }
        }
        else if (now_x % 2 == 1 && now_y % 3 == 1) {
            if (s[i] == 'a') {
                now_y--;
            }
            else if (s[i] == 'b') {
                now_y++;
            }
            else {
                now_x--;
            }
        }
        else if (now_x % 2 == 1 && now_y % 3 == 2) {
            if (s[i] == 'a') {
                now_x++;
            }
            else if (s[i] == 'b') {
                now_y--;
            }
            else {
                now_y++;
            }
        }
        st.insert({now_x,now_y});
    }
    cout << st.size() << endl;
    return 0;
}
0