Submission #2227457
Source Code Expand
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> #define p(s) cout<<(s)<<endl #define REP(i,n,N) for(int i=n;i<N;i++) #define RREP(i,n,N) for(int i=N-1;i>=n;i--) #define CK(n,a,b) ((a)<=(n)&&(n)<(b)) #define F first #define S second typedef long long ll; using namespace std; const ll mod = 1e9+7; string X; int main(){ cin>>X; int ans=X.size(); int tmp = 0; REP(i,0,X.size()){ if(X[i]=='S'){ tmp++; }else{ if(tmp>0){ ans-=2; tmp--; } } } p(ans); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - STring |
User | uwfdai |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 801 Byte |
Status | AC |
Exec Time | 8 ms |
Memory | 640 KB |
Judge Result
Set Name | Sample | Subtask1 | All | ||||||
---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | 100 / 100 | ||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
Sample | example0, example1, example2 |
Subtask1 | example0, example1, example2, sub_corner0, sub_corner1, sub_corner2, sub_rand0, handmade0, handmade1 |
All | corner0, corner1, corner2, example0, example1, example2, handmade0, handmade1, maxrand0, sub_corner0, sub_corner1, sub_corner2, sub_rand0 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
corner0 | AC | 8 ms | 640 KB |
corner1 | AC | 8 ms | 640 KB |
corner2 | AC | 8 ms | 640 KB |
example0 | AC | 1 ms | 256 KB |
example1 | AC | 1 ms | 256 KB |
example2 | AC | 1 ms | 256 KB |
handmade0 | AC | 1 ms | 256 KB |
handmade1 | AC | 1 ms | 256 KB |
maxrand0 | AC | 8 ms | 640 KB |
sub_corner0 | AC | 1 ms | 256 KB |
sub_corner1 | AC | 1 ms | 256 KB |
sub_corner2 | AC | 1 ms | 256 KB |
sub_rand0 | AC | 1 ms | 256 KB |