| Task: | Ositus |
| Sender: | kpop |
| Submission time: | 2021-10-07 11:32:35 +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 | WRONG ANSWER | 0.01 s | 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 | WRONG ANSWER | 0.01 s | 2, 3 | details |
| #6 | WRONG ANSWER | 0.01 s | 3 | details |
| #7 | WRONG ANSWER | 0.87 s | 3 | details |
Code
#include <bits/stdc++.h>
using namespace std;
int main() {
string str; cin >> str;
vector<int> points(str.length(), 0);
unordered_set<char> seen;
auto ita = str.rbegin();
auto itb = ita+1;
seen.insert(*ita);
while (ita != str.rend()) {
int bi = str.rend()-itb-1;
if (seen.find(*itb) == seen.end() && itb != str.rend()) {
seen.insert(*itb);
points[bi] += 1;
++itb;
} else {
++ita;
itb = ita+1;
seen.clear();
}
}
for (int i = points.size()-1; i >= 0; --i) {
points[i] += points[i+1];
}
points[points.size()-1] = 1;
int result = 0;
auto itc = str.begin();
auto itd = itc+1;
int i = 1;
seen.clear();
seen.insert(*itc);
while (itc != str.end()) {
int di = distance(str.begin(), itd);
if (seen.find(*itd) == seen.end() && itd != str.end()) {
seen.insert(*itd);
result += points[di+1];
if (!(seen.size() == 1 && result == 1 && str.length()-di-1==1)) result+=1;
++itd;
++i;
} else {
++itc;
itd = itc+1;
seen.clear();
}
}
cout << result%1000000007 << endl;
}Test details
Test 1
Group: 1, 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| a |
| correct output |
|---|
| 1 |
| user output |
|---|
| 0 |
Test 2
Group: 1, 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| abcdefghij |
| correct output |
|---|
| 512 |
| user output |
|---|
| 1484 |
Test 3
Group: 1, 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| abcabaacbc |
| correct output |
|---|
| 120 |
| user output |
|---|
| 587 |
Test 4
Group: 1, 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| aaxxxxxxaa |
| correct output |
|---|
| 4 |
| user output |
|---|
| 257 |
Test 5
Group: 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| mfyzvoxmppoxcvktmcjkryyocfweub... |
| correct output |
|---|
| 643221148 |
| user output |
|---|
| 165765 |
Test 6
Group: 3
Verdict: WRONG ANSWER
| input |
|---|
| weinscqmmpgbrlboocvtbptgbahmwv... |
| correct output |
|---|
| 831644159 |
| user output |
|---|
| 460378832 |
Test 7
Group: 3
Verdict: WRONG ANSWER
| input |
|---|
| sxaoxcyrjoeieyinaqxwukgzdnhhsw... |
| correct output |
|---|
| 816016015 |
| user output |
|---|
| 96454568 |
