Submission #904474
Source Code Expand
#pragma comment(linker, "/STACK:64000000") #include <iostream> #include <cmath> #include <cstdio> #include <cstring> #include <cstdlib> #include <cassert> #include <ctime> #include <sstream> #include <algorithm> #include <functional> #include <numeric> #include <string> #include <vector> #include <queue> #include <stack> #include <map> #include <set> #define ft first #define st second #define mp make_pair #define pb push_back #define sz(n) int(n.size()) #define all(n) n.begin(), n.end() using namespace std; typedef long long ll; typedef pair<int,int> pii; const int N = 1e5 + 123; const int inf = 1e9 + 7; const ll INF = 1e18 + 7; string s; int cnt [300], ans, balance ; int main () { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> s; for (int i = 0; i < sz(s); i ++) { if (s[i] == 'S') balance ++; else if (s[i] == 'T') { if (balance > 0) { balance --; ans += 2; } } } cout << sz(s) - ans; }
Submission Info
Submission Time | |
---|---|
Task | A - STring |
User | Erumaru |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 1045 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 | 384 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 |