Submission #1441009
Source Code Expand
#include <iostream> using namespace std; typedef unsigned long long u64; int main(void) { cin.tie(0); ios::sync_with_stdio(false); string s; cin >> s; int cnt = 0; int size = s.size(); int depth = 0; for (int i = 0; i < size; ++i) { if (s[i] == 'S') { depth++; } else { if (depth > 0) { depth--; } else { cnt++; } } } cout << cnt+depth << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - STring |
User | knk |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 459 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 |