結果
問題 | No.1292 パタパタ三角形 |
ユーザー | Mister |
提出日時 | 2021-01-23 12:38:16 |
言語 | C++17 (gcc 13.2.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 641 bytes |
コンパイル時間 | 1,627 ms |
コンパイル使用メモリ | 83,216 KB |
実行使用メモリ | 12,756 KB |
最終ジャッジ日時 | 2023-08-28 22:51:20 |
合計ジャッジ時間 | 2,760 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,380 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 2 ms
4,380 KB |
testcase_03 | AC | 2 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 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 8 ms
4,380 KB |
testcase_15 | AC | 8 ms
4,380 KB |
testcase_16 | AC | 8 ms
4,380 KB |
ソースコード
#line 1 "main.cpp" #include <iostream> #include <vector> #include <string> #include <set> using namespace std; const vector<pair<int, int>> dxys{{0, -1}, {1, 0}, {-1, 0}, {0, 1}, {1, 0}, {-1, 0}}; void solve() { string s; cin >> s; set<pair<int, int>> ss; int x = 0, y = 0; ss.emplace(x, y); for (char c : s) { int i = (c - 'a') * 2 + x; if (y % 2 != 0) i += 3; auto [dx, dy] = dxys[i % 6]; x += dx, y += dy; ss.emplace(x, y); } cout << ss.size() << "\n"; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); solve(); return 0; }