Submission #1455604
Source Code Expand
#include <ctime> #include <cstdio> #include <cstdlib> #include <cstring> #include <cassert> #include <algorithm> #include <iostream> #include <vector> #include <queue> #include <stack> #include <deque> #include <set> #include <map> using namespace std; typedef long long ll; typedef double lf; typedef long double Lf; typedef pair <int,int> pii; typedef pair <ll, ll> pll; #define TRACE(x) cerr << #x << " " << x << endl #define FOR(i, a, b) for (int i = (a); i < int(b); i++) #define REP(i, n) FOR(i, 0, n) #define all(x) (x).begin(), (x).end() #define _ << " " << #define fi first #define sec second #define mp make_pair const int MAXN = 200100; stack <int> s; string p; int main() { cin >> p; REP(i, (int)p.size()) { if (s.empty() || s.top() == 'T' || p[i] == 'S') s.push(p[i]); else { if (s.top() == 'S') {s.pop(); continue;} else s.push(p[i]); } } printf("%d\n",(int)s.size()); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - STring |
User | mkisic |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 971 Byte |
Status | AC |
Exec Time | 9 ms |
Memory | 1284 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 | 9 ms | 900 KB |
corner1 | AC | 9 ms | 1284 KB |
corner2 | AC | 9 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 | 9 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 |