Submission #1482787


Source Code Expand

#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<string.h>
#include<set>
#include<fstream>
#include<map>
#include<string>
#include <stdio.h>
#include<bitset>
#include<queue>
#include<iomanip>
#include<cmath>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll>vl;
typedef vector<int>vi;
typedef vector<bool>vb;
typedef vector<double>vd;
typedef vector<char>vc;
typedef vector<string>vs;
#define MP make_pair
#define oo 1000000
const ll mod = 1e9 + 7;

void ff()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL);
}

//#pragma warning (disable : 4996)
void in_out_txt()
{
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
}
int n, m, co, mx, l, r;
bool f;
char arr[25][25];
char ch1, ch2;
void dfs(int i, int j)
{
	if (i == l && j == r) f = 1;
	if (i == n || j == m || i == -1 || m == -1 || arr[i][j] == '0' || arr[i][j] != ch1)
		return;
	co++;
	arr[i][j] = '0';
	if (j + 1 == m)
	{
		dfs(i, 0);
	}
	if (j - 1 == -1)
	{
		dfs(i, m - 1);
	}
	dfs(i + 1, j);
	dfs(i, j + 1);
	dfs(i, j - 1);
	dfs(i - 1, j);
}
int main()
{
	ff();
	//in_out_txt();
	string str, st;
	int i = 0, j = 1, co = 0;
	cin >> str;
	while (j < str.size())
	{
		if (str[i] == 'S' && str[j] == 'T')
		{
			i--, j++, co++;
			if (i == -1)
				i = j, j = j + 1;
		}
		else
			i = j, j++;
	}
	int n = str.size();
	cout << n - co * 2 << endl;
	//system("pause");
	return 0;
}

Submission Info

Submission Time
Task A - STring
User george_samuel
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1573 Byte
Status WA
Exec Time 3 ms
Memory 720 KB

Compile Error

./Main.cpp: In function ‘void in_out_txt()’:
./Main.cpp:39:34: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
  freopen("input.txt", "r", stdin);
                                  ^
./Main.cpp:40:36: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
  freopen("output.txt", "w", stdout);
                                    ^

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 2 ms 720 KB
corner1 AC 2 ms 720 KB
corner2 WA 2 ms 720 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 WA 3 ms 720 KB
sub_corner0 WA 1 ms 256 KB
sub_corner1 AC 1 ms 256 KB
sub_corner2 WA 1 ms 256 KB
sub_rand0 WA 1 ms 256 KB