Submission #904304
Source Code Expand
/*░░░░░░░▄▄▄▀▀▀▄▄███▄ ░░░░░▄▀▀░░░░░░░▐░▀██▌ ░░░▄▀░░░░▄▄███░▌▀▀░▀█ ░░▄█░░▄▀▀▒▒▒▒▒▄▐░░░░█▌ ░▐█▀▄▀▄▄▄▄▀▀▀▀▌░░░░░▐█▄ ░▌▄▄▀▀░░░░░░░░▌░░░░▄███████▄ ░░░░░░░░░░░░░▐░░░░▐███████████▄ ░░░░░le░░░░░░░▐░░░░▐█████████████▄ ░░░░toucan░░░░░░▀▄░░░▐██████████████▄ ░░░░░░has░░░░░░░░▀▄▄████████████████▄ ░░░░░arrived░░░░░░░░░░░░█▀██████*/ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const int MAXN = 200 * 1000 + 7; char s[MAXN]; int main() { #ifdef LOCAL freopen("input.txt", "r", stdin); #endif scanf("%s", s); int n = strlen(s); vector<char> st; for (int i = 0; i < n; i++) { if (s[i] == 'T' && !st.empty() && st.back() == 'S') { st.pop_back(); } else { st.push_back(s[i]); } } printf("%d\n", (int)st.size()); }
Submission Info
Submission Time | |
---|---|
Task | A - STring |
User | gritukan |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 1382 Byte |
Status | AC |
Exec Time | 66 ms |
Memory | 1148 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:23:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%s", s); ^
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 | 66 ms | 1148 KB |
corner1 | AC | 4 ms | 768 KB |
corner2 | AC | 4 ms | 512 KB |
example0 | AC | 2 ms | 256 KB |
example1 | AC | 2 ms | 256 KB |
example2 | AC | 3 ms | 256 KB |
handmade0 | AC | 2 ms | 256 KB |
handmade1 | AC | 2 ms | 256 KB |
maxrand0 | AC | 4 ms | 384 KB |
sub_corner0 | AC | 2 ms | 256 KB |
sub_corner1 | AC | 2 ms | 256 KB |
sub_corner2 | AC | 2 ms | 256 KB |
sub_rand0 | AC | 2 ms | 256 KB |