Task: | Ositus |
Sender: | andreibe |
Submission time: | 2021-10-05 12:51:15 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | TIME LIMIT EXCEEDED | 0 |
#2 | TIME LIMIT EXCEEDED | 0 |
#3 | TIME LIMIT EXCEEDED | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | TIME LIMIT EXCEEDED | -- | 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: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: TIME LIMIT EXCEEDED
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: 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) |