Submission #905776
Source Code Expand
#include <bits/stdc++.h> using namespace std; #define READ() freopen("in.txt","r",stdin) #define WRITE() freopen("out.txt","w",stdout) #define sf(n) scanf("%d",&n) #define sl(x) scanf("%I64d",&x) #define lsf(n) scanf("%lld", &n) #define pb(n) push_back(n) #define mem(x,y) memset(x,y,sizeof(x)) #define DBG(x) cout << #x << " = " << x << endl #define YOLO cout << "YOLO" << endl #define EPS 1e-10 #define INF INT_MAX #define MAX 200010 #define MOD 1000000007 #define LL long long #define endl "\n" #define pi 2.0*acos(0.0) #define cnd tree[idx] #define lnd tree[left] #define rnd tree[right] #define callLeft left,st,mid #define callRight right,mid+1,ed int used[MAX]; int main() { // ios_base::sync_with_stdio(false); // cin.tie(0); /// use "\n" instead of endl // READ(); // WRITE(); string s; cin >> s; int len = s.size(); int ans = len; stack <char> st; int cntS = 0; for(int i=0;i<len;i++) { if(s[i] == 'S') { cntS++; } else { if(cntS > 0) { ans -= 2; cntS--; } } } cout << ans << endl; // main(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - STring |
User | WTFisThisShit |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 1400 Byte |
Status | AC |
Exec Time | 10 ms |
Memory | 640 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 | 9 ms | 640 KB |
corner1 | AC | 9 ms | 640 KB |
corner2 | AC | 9 ms | 640 KB |
example0 | AC | 2 ms | 256 KB |
example1 | AC | 2 ms | 256 KB |
example2 | AC | 2 ms | 256 KB |
handmade0 | AC | 2 ms | 256 KB |
handmade1 | AC | 2 ms | 256 KB |
maxrand0 | AC | 10 ms | 640 KB |
sub_corner0 | AC | 3 ms | 256 KB |
sub_corner1 | AC | 2 ms | 256 KB |
sub_corner2 | AC | 2 ms | 256 KB |
sub_rand0 | AC | 3 ms | 256 KB |