Submission #1819009


Source Code Expand

#include <bits/stdc++.h>
#define pb push_back
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

const int N=300000;
char s[N], x[N];

int main() {
    int i, sp=0;
    scanf("%s", s);
    for(i=0; s[i]; i++) {
        if(sp>0 && x[sp-1]=='S' && s[i]=='T') sp--;
        else x[sp++]=s[i];
    }
    printf("%d\n", sp);
    return 0;
}

Submission Info

Submission Time
Task A - STring
User Ajira
Language C++14 (GCC 5.4.1)
Score 300
Code Size 588 Byte
Status AC
Exec Time 3 ms
Memory 640 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:21: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 2 ms 512 KB
corner1 AC 2 ms 640 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