Submission #905399


Source Code Expand

#include <stdio.h>
#include <iostream>

#include <sstream>
#include <fstream>
#include <cmath>
#include <vector>


using namespace std;


void check( string val ){
	
	cout << val << endl;
}

int main( int argc , char ** argv ){
	
	string X;
	cin >> X;

	// check(X);

	bool ST_check = false;
	int S_count = 0;
	int T_count = 0;
	int m_count = 0;
	for(int i = 0 ; i < X.length() ; i++){

		if(X[i] == 'S'){
			
			if(!ST_check){

				int num = (S_count <= T_count) ? S_count : T_count;
				m_count += num*2;
				S_count = 0;
				T_count = 0;
			}
			ST_check = true;
			S_count ++;
		}

		if(X[i] == 'T'){

			T_count ++;
			ST_check = false;
		}

		if(m_count > 100000) {
			ST_check = true;
			break;
		}
	}
	if(!ST_check){

		int num = (S_count <= T_count) ? S_count : T_count;
		m_count += num*2;
	}

	cout << X.length() - m_count << endl;
	
}

Submission Info

Submission Time
Task A - STring
User tutinoko79
Language C++14 (GCC 5.4.1)
Score 0
Code Size 914 Byte
Status WA
Exec Time 111 ms
Memory 640 KB

Judge Result

Set Name Sample Subtask1 All
Score / Max Score 0 / 0 0 / 200 0 / 100
Status
AC × 3
AC × 6
WA × 3
AC × 7
WA × 6
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 9 ms 640 KB
corner1 AC 9 ms 640 KB
corner2 WA 111 ms 640 KB
example0 AC 3 ms 256 KB
example1 AC 3 ms 256 KB
example2 AC 3 ms 256 KB
handmade0 AC 3 ms 384 KB
handmade1 AC 3 ms 256 KB
maxrand0 WA 10 ms 640 KB
sub_corner0 WA 3 ms 256 KB
sub_corner1 AC 3 ms 256 KB
sub_corner2 WA 3 ms 256 KB
sub_rand0 WA 3 ms 256 KB