結果
| 問題 |
No.2924 <===Super Spaceship String===>
|
| コンテスト | |
| ユーザー |
はるお味
|
| 提出日時 | 2024-10-14 09:12:15 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 792 bytes |
| コンパイル時間 | 3,271 ms |
| コンパイル使用メモリ | 251,048 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-14 09:12:19 |
| 合計ジャッジ時間 | 3,774 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | AC * 6 WA * 5 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<VL> VVL;
typedef long long LL;
#define all(a) (a).begin(), (a).end()
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
int main() {
string s;cin>>s;
int n=s.size();
int ans=n;
int b=0,a;
stack<int> B;
rep(i,n){
if(s[i]=='<'){B.push(b); b=0;}
if(s[i]=='>'){
if(b>0){ans-=(b+2);
if(B.size()>0){
b=B.top();B.pop();
}
else{
b=0;
}
}
else{
b=0;
while(B.size()>0){B.pop();}
}
}
if(s[i]=='='){b++;}
}
cout<<ans<<endl;
}
はるお味