Submission #1542538


Source Code Expand

#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<vector>
#include <map>
#include <set>
#include <list>
#include<fstream>
#include<stdio.h>
#include<iomanip>
#include<climits>
#include<list>
#include <functional>
#include <utility>
#include <numeric>
#define all(v) ((v).begin()),((v).end())
#define sz(v) ((int)(v).size())
#define PI 3.14159265
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
int sumofdigit(int n)
{
	if (n < 0)
		n *= -1;
	if (!n)
		return 0;
	return n % 10 + sumofdigit(n / 10);
}
void prn(int a[], int sz)
{

	if (sz <= 0)
		return;
	sz--;
	prn(a, sz );
	cout << a[sz] << endl;
}
void rprn(int a[], int sz)
{

	if(sz <= 0)
		return;
	cout << a[sz-1] << endl;
	rprn(a, sz-1);

}
int sum(int n)
{
	if (n == 1)
		return 1;
	return n + sum(n - 1);
}
int fact(int n)
{
	if (n <= 1)
		return 1;
	return n*fact(n - 1);
}
int cnt(int a[], int sz)
{
	sz--;
	if (sz <= 0)
		return a[0]==0;
	if (a[sz] == 0)
		return 1 + cnt(a, sz);
	return cnt(a, sz);



}
int mn(int a[], int sz, int m = INT_MAX)
{
	sz--;
	if (sz <= 0)
		return a[0];
	m = min(m, mn(a, sz));
	return m;
}
int  main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	///////////////////////////////////////////

	string x,s;
	cin >> x;
	set<string>st;
	st.insert(x);
	for (int i = 0; i < sz(x); i++)
	{
		for (int j = i+1; j <= sz(x); j++)
		{
			reverse(s.begin() + i, s.begin() + j);
			st.insert(s);
			s = x;
		}
	}
cout<<sz(st)-1<<endl;
	return 0;
}

Submission Info

Submission Time
Task B - Reverse and Compare
User AhmedHafez
Language C++14 (Clang 3.8.0)
Score 0
Code Size 1724 Byte
Status RE
Exec Time 2602 ms
Memory 1678208 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 3
AC × 10
TLE × 8
RE × 5
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt, subtask_1_16.txt, subtask_1_17.txt
Case Name Status Exec Time Memory
sample_01.txt AC 9 ms 888 KB
sample_02.txt AC 1 ms 256 KB
sample_03.txt AC 1 ms 256 KB
subtask_1_01.txt AC 1 ms 256 KB
subtask_1_02.txt TLE 2103 ms 892 KB
subtask_1_03.txt AC 1 ms 256 KB
subtask_1_04.txt AC 1 ms 256 KB
subtask_1_05.txt AC 12 ms 4096 KB
subtask_1_06.txt TLE 2204 ms 1678208 KB
subtask_1_07.txt TLE 2275 ms -1385984 KB
subtask_1_08.txt RE 2028 ms -487348 KB
subtask_1_09.txt RE 1992 ms -487576 KB
subtask_1_10.txt RE 2063 ms -487152 KB
subtask_1_11.txt TLE 2602 ms -487108 KB
subtask_1_12.txt RE 2005 ms -487240 KB
subtask_1_13.txt RE 2098 ms -487512 KB
subtask_1_14.txt TLE 2103 ms 892 KB
subtask_1_15.txt TLE 2103 ms 892 KB
subtask_1_16.txt TLE 2340 ms -489016 KB
subtask_1_17.txt TLE 2326 ms -514724 KB