Submission #904306


Source Code Expand

/**
 *    author:  [itmo] enot.1.10
 *    created: 01.10.2016 14:59:57       
**/
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define mp make_pair
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define sz(a) ((int)(a).size())
#define all(a) (a).begin(),a.end()
#define pw(x) (1LL<<(x))

using namespace std;

typedef long long ll;
typedef double dbl;
typedef vector<int> vi;
typedef pair<int, int> pi;

const int inf = 1.01e9;
const dbl eps = 1e-9;

/* --- main part --- */

const int N = 2e5 + 10;

char s[N];

int main()
{
    #ifdef home
        assert(freopen("1.in", "r", stdin));
        assert(freopen("1.out", "w", stdout));
    #endif
    scanf("%s", s);
    int res =0;
    int n = strlen(s);
    int bal =0;
    forn(i, n)
    {
        if (s[i] == 'T') bal++;
        else bal--;
        res = max(res, bal * 2);
    }
    printf("%d\n", res);
    #ifdef home
        eprintf("time = %d ms\n", (int)(clock() * 1000. / CLOCKS_PER_SEC));
    #endif
    return 0;
}

Submission Info

Submission Time
Task A - STring
User enot
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1169 Byte
Status AC
Exec Time 56 ms
Memory 1020 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:40:19: 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
AC × 3
AC × 9
AC × 13
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 56 ms 1020 KB
corner1 AC 4 ms 384 KB
corner2 AC 4 ms 384 KB
example0 AC 2 ms 256 KB
example1 AC 3 ms 256 KB
example2 AC 2 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