Task: | Ositus |
Sender: | wolruso |
Submission time: | 2021-10-17 23:05:25 +0300 |
Language: | C++ (C++11) |
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 | 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 main()': input/code.cpp:33:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%s", str); ~~~~~^~~~~~~~~~~
Code
#include <stdio.h> #include <stdint.h> uint64_t getNumCombinations(char *str, uint32_t size, uint32_t previousIndx) { if(previousIndx + 1 >= size) return 1; uint64_t count; uint32_t chrCount[26]; uint8_t chrIndex; for(uint8_t i = 0; i < 26; i++) chrCount[i] = 0; count = 0; for(uint32_t i = previousIndx + 1; i < size; i++) { chrIndex = str[i] - 'a'; chrCount[chrIndex]++; if(chrCount[chrIndex] > 1) return count; count += getNumCombinations(str, size, i) % 1000000007; count %= 1000000007; } if(chrCount[str[0] - 'a'] == 0) count++; return count % 1000000007; } int main() { char str[1000001]; uint32_t strLength, i; uint64_t combinationCount; for(i = 0; i < 1000001; i++) str[i] = '\0'; scanf("%s", str); for(i = 0; i < 1000000 && str[i] != '\0'; i++); strLength = i; combinationCount = getNumCombinations(str, strLength, 0); printf("%lu", combinationCount); return 0; }
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 |
---|
132 |
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) |