Task: | Ositus |
Sender: | andreibe |
Submission time: | 2021-10-05 13:40:21 +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 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#3 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#4 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#5 | RUNTIME ERROR | 0.99 s | 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: TIME LIMIT EXCEEDED
input |
---|
a |
correct output |
---|
1 |
user output |
---|
(empty) |
Test 2
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
abcdefghij |
correct output |
---|
512 |
user output |
---|
512 163 |
Test 3
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
abcabaacbc |
correct output |
---|
120 |
user output |
---|
120 67 |
Test 4
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
aaxxxxxxaa |
correct output |
---|
4 |
user output |
---|
4 30 |
Test 5
Group: 2, 3
Verdict: RUNTIME ERROR
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) |