Submission #3458257
Source Code Expand
#include <bits/stdc++.h> using namespace std; #define rep(i, n) REP(i, 0, n) #define REP(i, k, n) for(auto i = k; i != n; i++) #define rrep(i, n) RREP(i, n, 0) #define RREP(i, n, k) for(auto i = n; i != k; i--) #define all(x, r) (x), (x)+(r) #define ALL(x) (x).begin(), (x).end() #define debug(x) cerr << #x << " " << x << endl #define exst(x, data) (data).find(x) != (data).end() #define mp make_pair #define mt make_tuple #define pb push_back #define eb emplace_back #define np next_permutation #define b32 bitset<32> using ll = long long; using Pii = pair<int,int>; using Tiii = tuple<int, int, int>; template<class T>using V = vector<T>; int main(){ cin.tie(0); ios::sync_with_stdio(false); string X; cin >> X; int ans = 0; int len = X.size(); int r = 0; rep(i,len) { if(X[i] == 'T') { if(r == 0) ans++; r = max(0, r-1); } else r++; } ans += r; cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - STring |
User | shirosha2 |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 1015 Byte |
Status | AC |
Exec Time | 3 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 | 2 ms | 720 KB |
corner1 | AC | 2 ms | 720 KB |
corner2 | AC | 2 ms | 720 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 | 3 ms | 720 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 |