Submission #2224990
Source Code Expand
#include <stdio.h> #include <stdlib.h> #include <string.h> #define FOR(i, a, b) for(i = a; i < b; ++i) #define REP(i, n) FOR(i, 0, n) #define comp(a, b) int comp(const void *a, const void *b) #define MOD 1000000007 typedef unsigned int uint; typedef unsigned long ul; typedef long long ll; typedef unsigned long long ull; uint min(uint a, uint b){ return a < b? a : b; } void TF_print(char boolean, char T[], char F[]){ if(boolean){ printf("%s\n", T); }else{ printf("%s\n", F); } } int main(){ char S[200001]; scanf("%s", S); uint len = strlen(S); uint i,s = 0, save = 0, t = 0, count = 0; REP(i, len){ if(S[i] == 'S'){ if(s == 0){ count += min(save, t) * 2; t = 0; } s++; }else if(S[i] == 'T'){ if(t == 0){ save = s; s = 0; } t++; } } count += min(save, t) * 2; printf("%u\n", len - count); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - STring |
User | kumachan_atcoder |
Language | C (Clang 3.8.0) |
Score | 0 |
Code Size | 1088 Byte |
Status | WA |
Exec Time | 5 ms |
Memory | 384 KB |
Judge Result
Set Name | Sample | Subtask1 | All | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 200 | 0 / 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 | WA | 1 ms | 384 KB |
corner1 | AC | 1 ms | 384 KB |
corner2 | WA | 2 ms | 384 KB |
example0 | AC | 5 ms | 128 KB |
example1 | AC | 1 ms | 128 KB |
example2 | AC | 1 ms | 128 KB |
handmade0 | AC | 1 ms | 128 KB |
handmade1 | AC | 1 ms | 128 KB |
maxrand0 | WA | 2 ms | 384 KB |
sub_corner0 | WA | 1 ms | 128 KB |
sub_corner1 | AC | 1 ms | 128 KB |
sub_corner2 | WA | 1 ms | 128 KB |
sub_rand0 | WA | 1 ms | 128 KB |