Submission #1354603
Source Code Expand
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <iostream> #include <algorithm> #include <vector> #include <stack> #include <deque> #include <queue> #include <set> #include <map> #include <unordered_map> #include <bitset> #include <string> #define pb push_back #define sz(V) ((int)(V).size()) #define allv(V) ((V).begin()),((V).end()) #define befv(V) ((V)[(sz(V)-2)]) #define upmin(ans,ansx) (ans)=min((ans),(ansx)) #define upmax(ans,ansx) (ans)=max((ans),(ansx)) #define INF (1100000099) #define INFLL (1100000000000000099ll) #define MOD (1000000009) #define MAXN (200005) using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<ld, ld> pdd; vector<char> V; char str[MAXN]; int N; int main() { scanf(" %s", str); N = (int)strlen(str); for(int i = 0; i < N; i++) { if(!V.empty() && V.back() == 'S' && str[i] == 'T') V.pop_back(); else V.pb(str[i]); } printf("%d\n", sz(V)); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - STring |
User | youngyojun |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 1064 Byte |
Status | AC |
Exec Time | 3 ms |
Memory | 768 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:37:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf(" %s", str); N = (int)strlen(str); ^
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 | 640 KB |
corner1 | AC | 2 ms | 768 KB |
corner2 | AC | 2 ms | 512 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 | 384 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 |