結果
| 問題 | No.2924 <===Super Spaceship String===> |
| コンテスト | |
| ユーザー |
はるお味
|
| 提出日時 | 2024-10-14 09:23:45 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 18 ms / 2,000 ms |
| コード長 | 901 bytes |
| 記録 | |
| コンパイル時間 | 3,479 ms |
| コンパイル使用メモリ | 337,156 KB |
| 実行使用メモリ | 7,972 KB |
| 最終ジャッジ日時 | 2026-05-05 13:40:30 |
| 合計ジャッジ時間 | 9,670 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 12 |
ソースコード
#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,mod=-1;
stack<int> B;
rep(i,n){
//cout<<B.size()<<' '<<ans<<' '<<b<<endl;
if(s[i]=='<'){
if(mod==1){B.push(b);}mod=1; b=0;}
if(s[i]=='>'){
if(b>0){ans-=(b+2);
if(B.size()>0){
b=B.top();B.pop();
}
else{
b=0;mod=-1;
}
}
else{
b=0;
while(B.size()>0){B.pop();}
mod=-1;
}
}
if(s[i]=='='&&mod==1){b++;}
}
cout<<ans<<endl;
}
はるお味