Submission #1798688
Source Code Expand
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<cstring>
#include<complex>
#include<cmath>
#include<algorithm>
#include<list>
#include<functional>
#define mp make_pair
#define X first
#define Y second
#define INF 1987654321
#define PI 3.14159265358979323846264
#define MOD 1000000007LL
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset(a,0,sizeof(a));
#define MEM_1(a) memset(a,-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef complex<double> base;
ll POW(ll a, ll b) { if (b == 0)return 1; if (b == 1)return a; if (b & 1)return (a*POW(a, b - 1)) % MOD; ll t = POW(a, b / 2); return (t*t) % MOD; }
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
int dx[] = { 0,-1,1,0 }, dy[] = { 1,0,0,-1 };//동북남서
char s[200001];
int main() {
stack<char> st;
scanf("%s", s);
for (char c : s)
{
if (c == 'T')st.push(c);
else if (!st.empty() && st.top() == 'T')st.pop();
else st.push(c);
}
printf("%d", st.size());
}
Submission Info
Submission Time
2017-11-23 02:37:45+0900
Task
A - STring
User
cheetose
Language
C++14 (GCC 5.4.1)
Score
0
Code Size
1517 Byte
Status
WA
Exec Time
3 ms
Memory
640 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:55:24: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘std::stack<char>::size_type {aka long unsigned int}’ [-Wformat=]
printf("%d", st.size());
^
./Main.cpp:48:16: 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
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
2 ms
640 KB
corner1
WA
2 ms
512 KB
corner2
WA
2 ms
512 KB
example0
WA
2 ms
432 KB
example1
WA
2 ms
432 KB
example2
WA
2 ms
432 KB
handmade0
WA
2 ms
512 KB
handmade1
WA
2 ms
432 KB
maxrand0
WA
3 ms
384 KB
sub_corner0
WA
2 ms
432 KB
sub_corner1
WA
2 ms
512 KB
sub_corner2
WA
2 ms
432 KB
sub_rand0
WA
2 ms
432 KB