結果
問題 | No.1292 パタパタ三角形 |
ユーザー |
![]() |
提出日時 | 2020-11-20 21:54:08 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,040 bytes |
コンパイル時間 | 1,662 ms |
コンパイル使用メモリ | 174,540 KB |
実行使用メモリ | 13,040 KB |
最終ジャッジ日時 | 2024-07-23 12:55:20 |
合計ジャッジ時間 | 2,627 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 WA * 7 |
ソースコード
/** * @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; }