Submission #904316
Source Code Expand
#pragma comment(linker, "/STACK:16777216") #define _CRT_SECURE_NO_WARNINGS #include <string> #include <vector> #include <map> #include <list> #include <iterator> #include <set> #include <queue> #include <iostream> #include <sstream> #include <stack> #include <deque> #include <cmath> #include <memory.h> #include <cstdlib> #include <cstdio> #include <cctype> #include <algorithm> #include <utility> #include <cassert> #include <complex> #include <time.h> using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define RFOR(i,b,a) for(int i=(b)-1;i>=(a);--i) #define FILL(A,val) memset(A,val,sizeof(A)) #define ITER(it,a) for(__typeof(a.begin()) it=a.begin();it!=a.end();++it) #define DBG1(a) cerr<<#a<<"="<<(a)<<"\n" #define DBG2(a,b) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n" #define ALL(V) V.begin(),V.end() #define SZ(V) (int)V.size() #define PB push_back #define MP make_pair typedef long long LL; typedef unsigned long long ULL; typedef vector<int> VI; typedef pair<int, int> PII; const double PI = acos(-1.0); const int INF = 1000 * 1000 * 1000 + 7; const LL LINF = 1LL * INF*INF; int main() { //freopen("in.txt","r",stdin); //freopen("out.txt", "w", stdout); ios::sync_with_stdio(0);cin.tie(0); string s; cin >> s; stack<char> st; FOR(i, 0, SZ(s)) { if (st.empty()) st.push(s[i]); else { if (s[i] == 'T' && st.top() == 'S') st.pop(); else st.push(s[i]); } } cout << SZ(st) << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - STring |
User | Andrew_Makar |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 1518 Byte |
Status | AC |
Exec Time | 5 ms |
Memory | 720 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 | 4 ms | 720 KB |
corner1 | AC | 4 ms | 720 KB |
corner2 | AC | 4 ms | 720 KB |
example0 | AC | 3 ms | 256 KB |
example1 | AC | 3 ms | 256 KB |
example2 | AC | 3 ms | 256 KB |
handmade0 | AC | 3 ms | 256 KB |
handmade1 | AC | 3 ms | 256 KB |
maxrand0 | AC | 5 ms | 720 KB |
sub_corner0 | AC | 3 ms | 256 KB |
sub_corner1 | AC | 3 ms | 256 KB |
sub_corner2 | AC | 3 ms | 256 KB |
sub_rand0 | AC | 3 ms | 256 KB |