結果
問題 |
No.2924 <===Super Spaceship String===>
|
ユーザー |
|
提出日時 | 2024-10-12 14:47:26 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 861 bytes |
コンパイル時間 | 2,281 ms |
コンパイル使用メモリ | 205,408 KB |
最終ジャッジ日時 | 2025-02-24 17:42:44 |
ジャッジサーバーID (参考情報) |
judge1 / judge |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 9 WA * 3 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); string s; cin >> s; int N = s.size(); set<int> S; for(int i=0; i<N; i++) S.insert(i); stack<int> st; for(int i=0; i<N; i++){ if(s.at(i) == '<'){st.push(i); continue;} if(s.at(i) == '=') continue; if(st.size()){ int l = st.top(); st.pop(); if(l+1 == i){ while(st.size()) st.pop(); continue; } auto itr = S.lower_bound(l); vector<int> era; while(itr != S.end()){ int p = *itr; if(p > i) break; era.push_back(p); itr++; } for(auto e : era) S.erase(e); } } cout << S.size() << endl; }