結果
問題 |
No.2924 <===Super Spaceship String===>
|
ユーザー |
![]() |
提出日時 | 2024-10-12 18:27:02 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 629 bytes |
コンパイル時間 | 2,142 ms |
コンパイル使用メモリ | 194,392 KB |
最終ジャッジ日時 | 2025-02-24 18:53:49 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 8 RE * 4 |
ソースコード
#include <bits/stdc++.h> using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int main() { fast_io(); string s; cin >> s; string st = ""; bool has_l = false, has_e = false; for (char c : s) { if (c == '<') { has_l = true; has_e = false; st += c; } else if (c == '=') { if (has_l) { has_e = true; } st += c; } else { if (has_l && has_e) { while (st.back() == '=') { st.pop_back(); } assert(st.back() == '<'); st.pop_back(); } else { has_l = false; has_e = false; st += c; } } } cout << st.size() << endl; }