CSES - Datatähti 2022 alku - Results
Submission details
Task:Ositus
Sender:andreibe
Submission time:2021-10-05 12:51:15 +0300
Language:C++11
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#1--1, 2, 3details
#2ACCEPTED0.01 s1, 2, 3details
#3ACCEPTED0.01 s1, 2, 3details
#4ACCEPTED0.01 s1, 2, 3details
#5--2, 3details
#6--3details
#7--3details

Compiler report

input/code.cpp: In function 'int total(std::vector<std::__cxx11::basic_string<char> >, int)':
input/code.cpp:22:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (s.find(c) != -1) {
       ~~~~~~~~~~^~~~~
input/code.cpp:30:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (size_t i = 0; i < size; i++)
                     ~~^~~~~~

Code

#include <iostream>
#include <string>
#include <math.h>
#include <map>
#include <algorithm>
#include <vector>
#include <iostream>
#include <fstream>
#include <set>
#include <unordered_map>

using namespace std;
typedef unsigned long long ll;
//https://cses.fi/dt/
string str;
int total(vector<string> v, int index) {
	char c = str[index];
	int size = v.size();
	for (size_t i = 0; i < v.size(); i++)
	{
		string s = v[i];
		if (s.find(c) != -1) {
			v.erase(v.begin()+i);
			i--;
		}
		else {
			v[i] = c + s;
		}
	}
	for (size_t i = 0; i < size; i++)
	{
		v.push_back(string(1, c));
	}
	if (index != 0) {
		return total(v, index -1);
	}
	else {
		return v.size();
	}
}
int main()
{
	cin >> str;
	int len = str.length();
	char last = str[len - 1];
	vector<string> v = {string(1,last)};
	int tot = total(v, len - 2);
	cout << tot;
}

Test details

Test 1

Group: 1, 2, 3

Verdict:

input
a

correct output
1

user output
(empty)

Test 2

Group: 1, 2, 3

Verdict: ACCEPTED

input
abcdefghij

correct output
512

user output
512

Test 3

Group: 1, 2, 3

Verdict: ACCEPTED

input
abcabaacbc

correct output
120

user output
120

Test 4

Group: 1, 2, 3

Verdict: ACCEPTED

input
aaxxxxxxaa

correct output
4

user output
4

Test 5

Group: 2, 3

Verdict:

input
mfyzvoxmppoxcvktmcjkryyocfweub...

correct output
643221148

user output
(empty)

Test 6

Group: 3

Verdict:

input
weinscqmmpgbrlboocvtbptgbahmwv...

correct output
831644159

user output
(empty)

Test 7

Group: 3

Verdict:

input
sxaoxcyrjoeieyinaqxwukgzdnhhsw...

correct output
816016015

user output
(empty)