Task: | Ositus |
Sender: | Matenstein |
Submission time: | 2021-10-05 19:43:26 +0300 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.01 s | 1, 2, 3 | details |
#2 | ACCEPTED | 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 | WRONG ANSWER | 0.01 s | 2, 3 | details |
#6 | WRONG ANSWER | 0.02 s | 3 | details |
#7 | TIME LIMIT EXCEEDED | -- | 3 | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:19:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int a = 0; a < input.size(); a++) ~~^~~~~~~~~~~~~~ input/code.cpp:22:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int b = 0; b < seen.size() - 1; b++)if (input[a] == seen[b]) ~~^~~~~~~~~~~~~~~~~ input/code.cpp:45:9: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (a == input.size() - 1 && current != a) ~~^~~~~~~~~~~~~~~~~~~ input/code.cpp:52:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int a = 0; a < parts.size(); a++) ~~^~~~~~~~~~~~~~
Code
#include <iostream> #include <string> #include <vector> using namespace std; struct partition { int start, end; }; long long maxi = 1; int main() { string input; cin >> input; int current = 0; vector<char>seen; vector<partition>parts; for (int a = 0; a < input.size(); a++) { seen.push_back(input[a]); for (int b = 0; b < seen.size() - 1; b++)if (input[a] == seen[b]) { if (b == current) { partition p; p.start = current, p.end = a; parts.push_back(p); current = a; seen[current] = '1'; } else { partition p; p.start = current, p.end = b; parts.push_back(p); p.start = b, p.end = a; parts.push_back(p); seen[current] = '1'; seen[b] = '1'; current = a; } break; } if (a == input.size() - 1 && current != a) { partition p; p.start = current, p.end = a; parts.push_back(p); } } for (int a = 0; a < parts.size(); a++) { int n = parts[a].end - parts[a].start; long long multiplicant = 1; if (input[parts[a].start] == input[parts[a].end]) { if (n > 1) { for (int b = 0; b < n; b++)multiplicant *= 2; multiplicant--; } } else for (int b = 0; b < n; b++) { multiplicant *= 2; } maxi *= multiplicant; } long long modulo = 10; for (long long i = 0; i < 9; i++) { modulo *= 10; } modulo += 7; cout << maxi % modulo << 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: WRONG ANSWER
input |
---|
abcabaacbc |
correct output |
---|
120 |
user output |
---|
141267 |
Test 4
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
aaxxxxxxaa |
correct output |
---|
4 |
user output |
---|
4590 |
Test 5
Group: 2, 3
Verdict: WRONG ANSWER
input |
---|
mfyzvoxmppoxcvktmcjkryyocfweub... |
correct output |
---|
643221148 |
user output |
---|
-4269084144 |
Test 6
Group: 3
Verdict: WRONG ANSWER
input |
---|
weinscqmmpgbrlboocvtbptgbahmwv... |
correct output |
---|
831644159 |
user output |
---|
0 |
Test 7
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
sxaoxcyrjoeieyinaqxwukgzdnhhsw... |
correct output |
---|
816016015 |
user output |
---|
(empty) |