QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#303053 | #4273. Good Game | C1942huangjiaxu | 3 | 39ms | 21840kb | C++14 | 2.5kb | 2024-01-11 17:22:22 | 2024-01-11 17:22:23 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+5;
int n,ln[N],m,a[N],c,s[N],Ln[N],M;
char S[N];
vector<pair<int,int> >ans;
void print(){
printf("%d\n",ans.size());
for(auto [x,y]:ans)printf("%d %d\n",x,y);
}
void add(int x,int y){
ans.push_back({x,y});
}
void del(int u){
int p=s[u-1]+1;
while(ln[u]>4){
add(p,3);
ln[u]-=3;
}
if(ln[u]==4)add(p,2),add(p,2);
else if(ln[u]==3)add(p,3);
else add(p,2);
}
bool work1(){
int u=a[1];
if(u-1!=m-u)return false;
del(u);
for(int i=u-1;i;--i)add(i,2);
return true;
}
bool check(){
if(!c)return false;
if(c==1){
if(!work1())return false;
print();
exit(0);
}
a[c+1]=m+1;
int mx=a[1]-1;
for(int i=1;i<=c;++i)mx=max(mx,a[i+1]-a[i]-1);
if(mx*2+1>m)return false;
return true;
}
void cutl(){
int u=a[1];
del(u);
int nm=u+1;
for(int i=u-1,j=u+1;i;--i,++j){
ln[i]+=ln[j];
del(i);
nm=j+1;
}
for(int i=nm;i<=m;++i)ln[i-nm+1]=ln[i];
c=0,m=m-nm+1;
for(int i=1;i<=m;++i)if(ln[i]>1)a[++c]=i;
for(int i=1;i<=m;++i)s[i]=s[i-1]+ln[i];
}
void cutr(){
int u=a[c];
del(u);
int nm=u-1;
for(int i=u+1,j=u-1;i<=m;++i,--j){
ln[j]+=ln[i];
del(j);
nm=j-1;
}
c=0,m=nm;
for(int i=1;i<=m;++i)if(ln[i]>1)a[++c]=i;
}
bool Del(int c,int p){
int l=p,r=p;
for(;c;++r,--l,--c){
ln[l-1]+=ln[r+1];
if(l-1<1||r+1>m)return false;
del(l);
}
int nm=l;
for(int i=l+1,j=r+1;j<=m;++i,++j){
nm=i;
ln[i]=ln[j];
}
m=nm,c=0;
for(int i=1;i<=m;++i)if(ln[i]>1)a[++c]=i;
for(int i=1;i<=m;++i)s[i]=s[i-1]+ln[i];
return true;
}
bool solve(){
if(!check())return false;
assert(m&1);
int o=1,mid=(m+1)/2;
while(a[o+1]<=mid)++o;
if(a[o]!=mid){
if(mid-a[o]<=a[o+1]-mid){
if(!Del(mid-a[o],a[o+1]))return false;
}
else{
if(!Del(a[o+1]-mid,a[o]))return false;
}
}
o=1,mid=(m+1)/2;
while(a[o+1]<=mid)++o;
assert(a[o]==mid);
for(int i=a[o],j=a[o];i;--i,++j){
ln[i-1]+=ln[j+1];
del(i);
}
print();
return true;
}
int main(){
scanf("%d%s",&n,S+1);
for(int i=1,j;j=i,i<=n;i=j+1){
while(j<n&&S[j+1]==S[i])++j;
ln[++m]=j-i+1,s[m]=s[m-1]+ln[m];
if(ln[m]>1)a[++c]=m;
}
if(!check())return puts("-1"),0;
if(!(m&1)){
M=m;
for(int i=1;i<=m;++i)Ln[i]=ln[i];
cutl();
if(solve())return 0;
ans.clear();
m=M,c=0;
for(int i=1;i<=m;++i)ln[i]=Ln[i];
for(int i=1;i<=m;++i)if(ln[i]>1)a[++c]=i;
for(int i=1;i<=m;++i)s[i]=s[i-1]+ln[i];
cutr();
if(solve())return 0;
puts("-1");
return 0;
}
if(!solve())puts("-1");
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 3
Accepted
Test #1:
score: 3
Accepted
time: 1ms
memory: 3900kb
input:
9 ABAABBBAA
output:
4 3 2 2 2 2 2 1 3
result:
ok good solution!
Test #2:
score: 0
Accepted
time: 0ms
memory: 3916kb
input:
13 ABABBABABBABA
output:
6 9 2 8 2 4 2 3 2 2 3 1 2
result:
ok good solution!
Test #3:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
15 AABABAABABAABAB
output:
7 1 2 9 2 8 2 4 2 3 2 2 3 1 2
result:
ok good solution!
Test #4:
score: 0
Accepted
time: 1ms
memory: 5872kb
input:
15 ABAABBBABAABBAB
output:
7 3 2 2 2 2 2 1 2 4 2 2 3 1 2
result:
ok good solution!
Test #5:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
1 B
output:
-1
result:
ok no solution
Test #6:
score: 0
Accepted
time: 0ms
memory: 3916kb
input:
2 BB
output:
1 1 2
result:
ok good solution!
Test #7:
score: 0
Accepted
time: 1ms
memory: 5960kb
input:
7 AAAABBB
output:
3 1 2 1 2 1 3
result:
ok good solution!
Test #8:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
11 BBBBBBAAAAA
output:
4 1 3 1 3 1 3 1 2
result:
ok good solution!
Test #9:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
2 AB
output:
-1
result:
ok no solution
Test #10:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
14 BAAAAAAAAAAAAA
output:
-1
result:
ok no solution
Test #11:
score: 0
Accepted
time: 1ms
memory: 5804kb
input:
14 ABBABAABBABBAB
output:
7 2 2 1 2 7 2 4 2 2 2 2 2 1 2
result:
ok good solution!
Test #12:
score: 0
Accepted
time: 1ms
memory: 3928kb
input:
15 BAABABABBABBAAB
output:
6 2 2 6 2 5 2 4 3 3 3 1 3
result:
ok good solution!
Test #13:
score: 0
Accepted
time: 1ms
memory: 3928kb
input:
14 BABBBBBBBBBBAB
output:
6 3 3 3 3 3 2 3 2 2 2 1 2
result:
ok good solution!
Test #14:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
15 BABAAAAAAAAABAB
output:
6 4 3 4 3 4 3 3 2 2 2 1 2
result:
ok good solution!
Test #15:
score: 0
Accepted
time: 0ms
memory: 3936kb
input:
14 BBBABAAAAAAABA
output:
6 1 3 3 3 3 2 3 2 2 2 1 2
result:
ok good solution!
Test #16:
score: 0
Accepted
time: 1ms
memory: 7920kb
input:
15 AAAABABAAAAABAB
output:
7 1 2 1 2 4 3 4 2 3 2 2 2 1 2
result:
ok good solution!
Test #17:
score: 0
Accepted
time: 0ms
memory: 3932kb
input:
14 BAAABABAAAABAB
output:
6 2 3 5 2 5 2 4 2 3 2 1 3
result:
ok good solution!
Test #18:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
15 ABAAAABABBBBABA
output:
7 3 2 3 2 5 2 5 2 4 2 2 3 1 2
result:
ok good solution!
Test #19:
score: 0
Accepted
time: 0ms
memory: 3928kb
input:
14 BABAAABAAAABAB
output:
6 8 2 8 2 4 3 3 3 2 2 1 2
result:
ok good solution!
Test #20:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
15 BABBABABBBBBBAB
output:
6 8 3 8 3 7 2 3 2 2 2 1 3
result:
ok good solution!
Test #21:
score: 0
Accepted
time: 0ms
memory: 3884kb
input:
14 BABAAAABABBBAB
output:
6 10 3 4 2 4 2 3 2 2 3 1 2
result:
ok good solution!
Test #22:
score: 0
Accepted
time: 0ms
memory: 3936kb
input:
15 BABAAAAAABABAAB
output:
6 13 2 4 3 4 3 3 2 2 2 1 3
result:
ok good solution!
Test #23:
score: 0
Accepted
time: 0ms
memory: 5956kb
input:
14 BABBBBBABAAAAA
output:
6 3 3 3 2 2 2 1 2 1 3 1 2
result:
ok good solution!
Test #24:
score: 0
Accepted
time: 1ms
memory: 5984kb
input:
15 BABAAAABABAAAAA
output:
7 4 2 4 2 3 2 2 2 1 2 1 3 1 2
result:
ok good solution!
Test #25:
score: 0
Accepted
time: 1ms
memory: 5864kb
input:
15 BAABABAABAABBAA
output:
7 2 2 1 2 6 2 3 2 2 2 2 2 1 3
result:
ok good solution!
Test #26:
score: 0
Accepted
time: 1ms
memory: 5976kb
input:
15 AABAABBAABAABAB
output:
7 1 2 9 2 6 2 4 2 4 2 2 3 1 2
result:
ok good solution!
Test #27:
score: 0
Accepted
time: 1ms
memory: 5968kb
input:
15 AABABBABAABBABB
output:
6 1 2 3 2 5 2 4 3 2 3 1 3
result:
ok good solution!
Test #28:
score: 0
Accepted
time: 1ms
memory: 5868kb
input:
15 BAABBABBAABABBA
output:
6 2 2 1 3 8 2 4 2 2 3 1 3
result:
ok good solution!
Test #29:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
15 BBAABBABABABBAA
output:
-1
result:
ok no solution
Test #30:
score: 0
Accepted
time: 0ms
memory: 5864kb
input:
15 ABABBAABBAABBAB
output:
-1
result:
ok no solution
Test #31:
score: 0
Accepted
time: 1ms
memory: 5884kb
input:
14 AAABAAAAABAAAB
output:
5 1 3 8 3 2 3 2 2 1 3
result:
ok good solution!
Test #32:
score: 0
Accepted
time: 0ms
memory: 5980kb
input:
15 ABBBBABBBBBABBB
output:
6 13 3 7 3 7 2 2 2 2 2 1 3
result:
ok good solution!
Test #33:
score: 0
Accepted
time: 1ms
memory: 5876kb
input:
14 BBBBABBABAAABA
output:
6 1 2 1 2 2 2 4 3 3 2 1 3
result:
ok good solution!
Test #34:
score: 0
Accepted
time: 0ms
memory: 3764kb
input:
15 AAAAABABBBABBAB
output:
6 1 3 1 2 7 2 3 3 2 3 1 2
result:
ok good solution!
Test #35:
score: 0
Accepted
time: 0ms
memory: 5888kb
input:
14 AABABBBBABAAAB
output:
6 1 2 9 3 3 2 3 2 2 2 1 3
result:
ok good solution!
Test #36:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
15 BAABAAAABABBBBA
output:
7 11 2 11 2 10 2 5 2 5 2 2 2 1 3
result:
ok good solution!
Test #37:
score: 0
Accepted
time: 0ms
memory: 3764kb
input:
14 ABBBABAAABAAAB
output:
5 2 3 1 2 6 3 2 3 1 3
result:
ok good solution!
Test #38:
score: 0
Accepted
time: 0ms
memory: 3940kb
input:
15 BAAABABBBBABAAA
output:
6 13 3 2 3 4 2 4 2 3 2 1 3
result:
ok good solution!
Test #39:
score: 0
Accepted
time: 1ms
memory: 5860kb
input:
14 BABBABBBBABAAA
output:
6 12 3 6 2 6 2 3 2 2 3 1 2
result:
ok good solution!
Test #40:
score: 0
Accepted
time: 0ms
memory: 3764kb
input:
15 ABAAABABBBABBBB
output:
6 12 2 12 2 8 3 3 3 2 2 1 3
result:
ok good solution!
Test #41:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
14 AABABABBAABBAA
output:
-1
result:
ok no solution
Test #42:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
15 AABBBABABAABBAA
output:
-1
result:
ok no solution
Test #43:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
14 AABBAABABABBAA
output:
-1
result:
ok no solution
Test #44:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
15 BBBAABBAABABABB
output:
-1
result:
ok no solution
Test #45:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
15 BABABBBBAABBAAA
output:
-1
result:
ok no solution
Test #46:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
15 BBBABABAABBBAAA
output:
-1
result:
ok no solution
Test #47:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
15 AAABBBBAABABABB
output:
-1
result:
ok no solution
Test #48:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
15 AAAAABBAABBABAB
output:
-1
result:
ok no solution
Test #49:
score: 0
Accepted
time: 1ms
memory: 5740kb
input:
15 BAAAABBAABBBABA
output:
-1
result:
ok no solution
Test #50:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
15 BABAAABBBAAABBA
output:
-1
result:
ok no solution
Subtask #2:
score: 0
Wrong Answer
Test #51:
score: 6
Accepted
time: 1ms
memory: 5768kb
input:
299 ABABABABABABABABABABABABABABABABABBAABBAABBAABBAAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBBAABBAABBAABBAABBAABBAABBAABBAABBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABA...
output:
-1
result:
ok no solution
Test #52:
score: 0
Accepted
time: 1ms
memory: 5796kb
input:
300 ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAABBAABBAABBAABBAABBAABBAABBAABBAAABBAABBAABBAABBAABBAABBAABBAABBBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAAB...
output:
-1
result:
ok no solution
Test #53:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
299 ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABBBBBBBBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABBBBBBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB...
output:
147 199 3 199 3 198 2 197 2 196 2 195 2 194 2 193 2 192 2 191 2 190 2 189 2 188 2 187 2 186 2 185 2 184 2 183 2 182 2 181 2 180 2 179 2 178 2 177 2 176 2 175 2 174 2 173 2 172 2 171 2 170 2 169 2 168 2 167 2 166 2 165 2 164 2 163 2 162 2 161 2 160 2 159 2 158 2 157 2 156 2 155 2 154 2 153 2 152 2 96...
result:
ok good solution!
Test #54:
score: 0
Accepted
time: 1ms
memory: 5960kb
input:
299 BBBBBBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABBBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABBBBBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB...
output:
147 1 3 1 3 194 3 194 2 193 2 192 2 191 2 190 2 189 2 188 2 187 2 186 2 185 2 184 2 183 2 182 2 181 2 180 2 179 2 178 2 177 2 176 2 175 2 174 2 173 2 172 2 171 2 170 2 169 2 168 2 167 2 166 2 165 2 164 2 163 2 162 2 161 2 160 2 159 2 158 2 157 2 156 2 155 2 154 2 153 2 152 2 151 2 150 2 149 2 148 2 ...
result:
ok good solution!
Test #55:
score: 0
Accepted
time: 0ms
memory: 5908kb
input:
297 BABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAABBBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABBAABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABA
output:
148 74 2 73 2 73 2 72 2 71 2 70 2 69 2 68 2 67 2 66 2 65 2 64 2 63 2 62 2 61 2 60 2 59 2 58 2 57 2 56 2 55 2 54 2 53 2 52 2 51 2 50 2 49 2 48 2 47 2 46 2 45 2 44 2 43 2 42 2 41 2 40 2 39 2 38 2 37 2 36 2 35 2 34 2 33 2 32 2 31 2 30 2 29 2 28 2 27 2 26 2 25 2 24 2 23 2 22 2 21 2 20 2 19 2 18 2 17 2 1...
result:
ok good solution!
Test #56:
score: -6
Wrong Answer
time: 0ms
memory: 3732kb
input:
300 BABABABABABABABABABABABABABABABABABABABABABABABABABABABABAAAABBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABBBAAABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABA...
output:
-1
result:
wrong answer you didn't find a solution but jury did
Subtask #3:
score: 0
Wrong Answer
Test #102:
score: 7
Accepted
time: 1ms
memory: 4020kb
input:
5998 BABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB...
output:
2997 3995 3 3995 3 3995 3 3994 2 3993 2 3992 2 3991 2 3990 2 3989 2 3988 2 3987 2 3986 2 3985 2 3984 2 3983 2 3982 2 3981 2 3980 2 3979 2 3978 2 3977 2 3976 2 3975 2 3974 2 3973 2 3972 2 3971 2 3970 2 3969 2 3968 2 3967 2 3966 2 3965 2 3964 2 3963 2 3962 2 3961 2 3960 2 3959 2 3958 2 3957 2 3956 2 3...
result:
ok good solution!
Test #103:
score: 0
Accepted
time: 0ms
memory: 4064kb
input:
5999 BBBBBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB...
output:
2998 1 3 1 2 3995 3 3995 2 3994 2 3993 2 3992 2 3991 2 3990 2 3989 2 3988 2 3987 2 3986 2 3985 2 3984 2 3983 2 3982 2 3981 2 3980 2 3979 2 3978 2 3977 2 3976 2 3975 2 3974 2 3973 2 3972 2 3971 2 3970 2 3969 2 3968 2 3967 2 3966 2 3965 2 3964 2 3963 2 3962 2 3961 2 3960 2 3959 2 3958 2 3957 2 3956 2 ...
result:
ok good solution!
Test #104:
score: 0
Accepted
time: 1ms
memory: 6044kb
input:
5998 ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABA...
output:
2998 1499 3 1498 3 1497 2 1496 2 1495 2 1494 2 1493 2 1492 2 1491 2 1490 2 1489 2 1488 2 1487 2 1486 2 1485 2 1484 2 1483 2 1482 2 1481 2 1480 2 1479 2 1478 2 1477 2 1476 2 1475 2 1474 2 1473 2 1472 2 1471 2 1470 2 1469 2 1468 2 1467 2 1466 2 1465 2 1464 2 1463 2 1462 2 1461 2 1460 2 1459 2 1458 2 1...
result:
ok good solution!
Test #105:
score: -7
Wrong Answer
time: 1ms
memory: 3740kb
input:
5998 ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABA...
output:
-1
result:
wrong answer you didn't find a solution but jury did
Subtask #4:
score: 0
Wrong Answer
Test #153:
score: 9
Accepted
time: 36ms
memory: 17980kb
input:
999997 ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABA...
output:
499996 666661 3 666661 3 666661 2 666661 2 666660 2 666659 2 666658 2 666657 2 666656 2 666655 2 666654 2 666653 2 666652 2 666651 2 666650 2 666649 2 666648 2 666647 2 666646 2 666645 2 666644 2 666643 2 666642 2 666641 2 666640 2 666639 2 666638 2 666637 2 666636 2 666635 2 666634 2 666633 2 66663...
result:
ok good solution!
Test #154:
score: 0
Accepted
time: 39ms
memory: 21840kb
input:
999998 BBBBBBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABA...
output:
499996 1 3 1 3 666661 3 666661 2 666660 2 666659 2 666658 2 666657 2 666656 2 666655 2 666654 2 666653 2 666652 2 666651 2 666650 2 666649 2 666648 2 666647 2 666646 2 666645 2 666644 2 666643 2 666642 2 666641 2 666640 2 666639 2 666638 2 666637 2 666636 2 666635 2 666634 2 666633 2 666632 2 666631...
result:
ok good solution!
Test #155:
score: 0
Accepted
time: 39ms
memory: 21688kb
input:
999997 BABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB...
output:
499998 249999 2 249998 2 249998 2 249997 2 249996 2 249995 2 249994 2 249993 2 249992 2 249991 2 249990 2 249989 2 249988 2 249987 2 249986 2 249985 2 249984 2 249983 2 249982 2 249981 2 249980 2 249979 2 249978 2 249977 2 249976 2 249975 2 249974 2 249973 2 249972 2 249971 2 249970 2 249969 2 24996...
result:
ok good solution!
Test #156:
score: -9
Wrong Answer
time: 12ms
memory: 20528kb
input:
999998 ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABA...
output:
-1
result:
wrong answer you didn't find a solution but jury did