Submission #1544055


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 s;
	cin >> s;
set<string>ss;
for(int i=0;i<sz(s);i++)
{
    for(int j=i+1;j<sz(s);j++)
    {string x=s;
        reverse(x.begin()+i,x.begin()+j+1);
        ss.insert(x);
    }
}
cout<<sz(ss)<<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 1698 Byte
Status WA
Exec Time 3968 ms
Memory 1645440 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 3
AC × 8
WA × 2
TLE × 13
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 6 ms 888 KB
sample_02.txt AC 1 ms 256 KB
sample_03.txt AC 1 ms 256 KB
subtask_1_01.txt WA 1 ms 256 KB
subtask_1_02.txt TLE 2103 ms 892 KB
subtask_1_03.txt WA 1 ms 256 KB
subtask_1_04.txt AC 1 ms 256 KB
subtask_1_05.txt AC 13 ms 4096 KB
subtask_1_06.txt TLE 2202 ms 1645440 KB
subtask_1_07.txt TLE 2281 ms -1319424 KB
subtask_1_08.txt TLE 3652 ms -490952 KB
subtask_1_09.txt TLE 2529 ms -490484 KB
subtask_1_10.txt TLE 3403 ms -490804 KB
subtask_1_11.txt TLE 3968 ms -490300 KB
subtask_1_12.txt TLE 3657 ms -490504 KB
subtask_1_13.txt TLE 2522 ms -490396 KB
subtask_1_14.txt TLE 2103 ms 892 KB
subtask_1_15.txt TLE 2103 ms 892 KB
subtask_1_16.txt TLE 3911 ms -490396 KB
subtask_1_17.txt TLE 2317 ms -652420 KB