| Task: | Ositus |
| Sender: | motsgar |
| Submission time: | 2021-10-06 23:36:23 +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.01 s | 3 | details |
| #7 | WRONG ANSWER | 0.12 s | 3 | details |
Compiler report
input/code.cpp: In function 'int main(int, char**)':
input/code.cpp:68:13: warning: unused variable 'mys' [-Wunused-variable]
int mys = 0;
^~~
input/code.cpp:25:8: warning: variable 'removed' set but not used [-Wunused-but-set-variable]
ll removed = 0;
^~~~~~~Code
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(int argc, char **argv)
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string in;
cin >> in;
ll length = 1;
unsigned int biggestPos = 0;
bool rem = false;
int skip = 0;
ll lastRem = 0;
ll removed = 0;
for (unsigned int i = 0; i < in.size(); i++)
{
vector<ll> v(122, -1);
unsigned int pos = i + 1;
v[in[i]] = i;
while (pos < in.size())
{
if (v[in[pos]] != -1)
{
break;
}
v[in[pos]] = pos;
pos++;
}
//cout << "a: " << pos << " " << biggestPos << " " << i << endl;
if (pos == i + 1)
{
//cout << "mui" << endl;
rem = false;
lastRem = 0;
removed = 0;
continue;
}
if (pos == biggestPos)
{
skip++;
continue;
}
int slength = pos - biggestPos;
if (!rem)
slength--;
ll thing = 1 << slength;
ll tmp = length * thing;
//cout << "b: " << slength << " " << thing << endl;
//cout << "skip: " << skip << endl;
int mys = 0;
if (rem)
{
//cout << "remove: " << lastRem << endl;
ll toRem = (1 << (slength - 1)) * ((1 << (skip + lastRem)) - lastRem);
tmp -= toRem;
lastRem = slength + skip + lastRem;
}
length = (tmp) % 1000000007;
biggestPos = pos;
rem = true;
skip = 0;
}
cout << length << "\n";
}
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 |
|---|
| 158 |
Test 4
Group: 1, 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| aaxxxxxxaa |
| correct output |
|---|
| 4 |
| user output |
|---|
| 128 |
Test 5
Group: 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| mfyzvoxmppoxcvktmcjkryyocfweub... |
| correct output |
|---|
| 643221148 |
| user output |
|---|
| 605617495 |
Test 6
Group: 3
Verdict: WRONG ANSWER
| input |
|---|
| weinscqmmpgbrlboocvtbptgbahmwv... |
| correct output |
|---|
| 831644159 |
| user output |
|---|
| 924338128 |
Test 7
Group: 3
Verdict: WRONG ANSWER
| input |
|---|
| sxaoxcyrjoeieyinaqxwukgzdnhhsw... |
| correct output |
|---|
| 816016015 |
| user output |
|---|
| -8512130 |
