結果
問題 | No.1292 パタパタ三角形 |
ユーザー |
![]() |
提出日時 | 2020-11-21 00:48:11 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,818 bytes |
コンパイル時間 | 2,063 ms |
コンパイル使用メモリ | 198,904 KB |
最終ジャッジ日時 | 2025-01-16 03:40:54 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 WA * 7 |
ソースコード
#include <bits/stdc++.h> #define M_PI 3.14159265358979323846 // pi using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<ll> VI; typedef pair<ll, ll> P; typedef tuple<ll, ll, ll> t3; typedef tuple<ll, ll, ll, ll> t4; typedef tuple<ll, ll, ll, ll, ll> t5; #define rep(a,n) for(ll a = 0;a < n;a++) #define repi(a,b,n) for(ll a = b;a < n;a++) template<typename T> static inline void chmin(T& ref, const T value) { if (ref > value) ref = value; } template<typename T> static inline void chmax(T& ref, const T value) { if (ref < value) ref = value; } constexpr ll INF = 1e15; int main() { string s; cin >> s; set<P> p; p.emplace(100000, 100000); int n = s.size(); P current = { 100000,100000 }; for (int i = 0; i < n; i++) { char c = s[i]; int x = current.first; int y = current.second; if (c == 'a') { if (y % 2 == 0) { if (x % 2 == 0) { current = { x, y + 1 }; } else { current = { x, y - 1 }; } } else { if (x % 2 == 0) { current = { x, y - 1 }; } else { current = { x, y + 1 }; } } } else if (c == 'b') { if (x % 2 == 0) { current = { x+1, y}; } else { current = { x-1, y}; } } else { if (x % 2 == 0) { current = { x - 1, y }; } else { current = { x + 1, y }; } } p.emplace(current); } cout << p.size() << endl; return 0; }