| Task: | Ositus |
| Sender: | andreibe |
| Submission time: | 2021-10-05 13:40:41 +0300 |
| Language: | C++ (C++11) |
| Status: | READY |
| Result: | 40 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 40 |
| #2 | TIME LIMIT EXCEEDED | 0 |
| #3 | TIME LIMIT EXCEEDED | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | ACCEPTED | 0.01 s | 1, 2, 3 | details |
| #2 | ACCEPTED | 0.01 s | 1, 2, 3 | details |
| #3 | ACCEPTED | 0.01 s | 1, 2, 3 | details |
| #4 | ACCEPTED | 0.01 s | 1, 2, 3 | details |
| #5 | TIME LIMIT EXCEEDED | -- | 2, 3 | details |
| #6 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #7 | TIME LIMIT EXCEEDED | -- | 3 | details |
Compiler report
input/code.cpp: In function 'int total(std::vector<std::__cxx11::basic_string<char> >, int)':
input/code.cpp:24:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (s.find(c) != -1) {
~~~~~~~~~~^~~~~
input/code.cpp:32: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>
#include <chrono>
using namespace std::chrono;
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;
//auto start = high_resolution_clock::now();
int len = str.length();
if (len == 1) {
cout << 1;
return 0;
}
char last = str[len - 1];
vector<string> v = { string(1,last) };
int tot = total(v, len - 2);
cout << tot << "\n";
//auto stop = high_resolution_clock::now();
//auto duration = duration_cast<microseconds>(stop - start);
//cout << duration.count() << endl;
}
Test details
Test 1
Group: 1, 2, 3
Verdict: ACCEPTED
| input |
|---|
| a |
| correct output |
|---|
| 1 |
| user output |
|---|
| 1 |
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: TIME LIMIT EXCEEDED
| input |
|---|
| mfyzvoxmppoxcvktmcjkryyocfweub... |
| correct output |
|---|
| 643221148 |
| user output |
|---|
| (empty) |
Test 6
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| weinscqmmpgbrlboocvtbptgbahmwv... |
| correct output |
|---|
| 831644159 |
| user output |
|---|
| (empty) |
Test 7
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| sxaoxcyrjoeieyinaqxwukgzdnhhsw... |
| correct output |
|---|
| 816016015 |
| user output |
|---|
| (empty) |
