Submission #1482784
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;
cin >> str;
while (1)
{
st = "";
for (int i = 0; i < str.size(); i++)
{
if (i == str.size() - 1)
{
st += str[i];
break;
}
if (str[i] == 'S' && str[i + 1] == 'T')
i++;
else
st += str[i];
}
if (st == str) break;
str = st;
}
cout << str.size() << endl;
//system("pause");
return 0;
}
Submission Info
Submission Time |
|
Task |
A - STring |
User |
george_samuel |
Language |
C++14 (GCC 5.4.1) |
Score |
200 |
Code Size |
1631 Byte |
Status |
TLE |
Exec Time |
1055 ms |
Memory |
916 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 |
200 / 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 |
TLE |
1055 ms |
916 KB |
corner1 |
AC |
3 ms |
916 KB |
corner2 |
AC |
7 ms |
916 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 |
8 ms |
720 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 |