QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#69215 | #5212. Palindrom | Index | 10 ✓ | 4ms | 2552kb | C11 | 573b | 2022-12-25 15:38:18 | 2022-12-25 15:38:19 |
Judging History
answer
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char s[204800];
int a[204800];
int main(void) {
int n, acnt = 0;
long long res = 0;
scanf("%s", s);
n = strlen(s);
for (int i = 0; i < n; i++) {
if (s[i] == 'a') a[acnt++] = i;
}
if ((acnt & 1) && (~n & 1)) {
printf("-1");
return 0;
}
for (int i = 0, j = acnt - 1; i <= j; i++, j--) {
if (i < j) res += abs(a[i] - (n - 1 - a[j]));
else res += abs(a[i] - (n >> 1));
}
printf("%lld", res);
return 0;
}
详细
Subtask #1:
score: 1
Accepted
Test #1:
score: 1
Accepted
time: 1ms
memory: 1680kb
input:
b
output:
0
result:
ok single line: '0'
Test #2:
score: 0
Accepted
time: 1ms
memory: 1680kb
input:
bb
output:
0
result:
ok single line: '0'
Test #3:
score: 0
Accepted
time: 0ms
memory: 1680kb
input:
aaaabbaaba
output:
-1
result:
ok single line: '-1'
Test #4:
score: 0
Accepted
time: 1ms
memory: 1688kb
input:
abbbbaaaabbb
output:
-1
result:
ok single line: '-1'
Test #5:
score: 0
Accepted
time: 1ms
memory: 1548kb
input:
aaaabbababbabb
output:
-1
result:
ok single line: '-1'
Test #6:
score: 0
Accepted
time: 1ms
memory: 1684kb
input:
bbbbbbbbbbbbbbb
output:
0
result:
ok single line: '0'
Test #7:
score: 0
Accepted
time: 0ms
memory: 1460kb
input:
bbbbbbbbaaaaaaa
output:
28
result:
ok single line: '28'
Test #8:
score: 0
Accepted
time: 1ms
memory: 1688kb
input:
aaaaaaabbbbbb
output:
21
result:
ok single line: '21'
Subtask #2:
score: 1
Accepted
Test #9:
score: 1
Accepted
time: 1ms
memory: 1568kb
input:
a
output:
0
result:
ok single line: '0'
Test #10:
score: 0
Accepted
time: 1ms
memory: 1580kb
input:
aba
output:
0
result:
ok single line: '0'
Test #11:
score: 0
Accepted
time: 1ms
memory: 1688kb
input:
abababaaabb
output:
3
result:
ok single line: '3'
Test #12:
score: 0
Accepted
time: 1ms
memory: 1644kb
input:
aabaabbbaabbb
output:
11
result:
ok single line: '11'
Test #13:
score: 0
Accepted
time: 0ms
memory: 1628kb
input:
aaababaabbababa
output:
7
result:
ok single line: '7'
Test #14:
score: 0
Accepted
time: 0ms
memory: 1684kb
input:
aaaaaaaaaaaaaaa
output:
0
result:
ok single line: '0'
Test #15:
score: 0
Accepted
time: 1ms
memory: 1552kb
input:
bbbbbbbaaaaaaa
output:
-1
result:
ok single line: '-1'
Test #16:
score: 0
Accepted
time: 1ms
memory: 1628kb
input:
aaaaaabbbbbb
output:
18
result:
ok single line: '18'
Subtask #3:
score: 1
Accepted
Test #17:
score: 1
Accepted
time: 1ms
memory: 1628kb
input:
bbbbaaaaabbbbabbaaabaababbabaaaabbbabbbaabbbabaaaabbbbaaababbaaabbabbbaabbaabaabbbababbabaabbbabbba
output:
70
result:
ok single line: '70'
Test #18:
score: 0
Accepted
time: 1ms
memory: 1684kb
input:
baabbaabaaabbabbaababbababbaabbabaabaaabbbbbaabbababbbabababbabbbaaaababbbbbbbbbaabbbabbbaaaabbbbbaa
output:
-1
result:
ok single line: '-1'
Test #19:
score: 0
Accepted
time: 1ms
memory: 1688kb
input:
babaaababbbbbaabbbbabbbbabbbbbbabbbbaabbbbbbabbbbbbbabbababaabbbbabbbbabaababbabbabaab
output:
-1
result:
ok single line: '-1'
Test #20:
score: 0
Accepted
time: 1ms
memory: 1684kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
output:
1250
result:
ok single line: '1250'
Test #21:
score: 0
Accepted
time: 0ms
memory: 1540kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
output:
-1
result:
ok single line: '-1'
Subtask #4:
score: 1
Accepted
Test #22:
score: 1
Accepted
time: 1ms
memory: 1716kb
input:
bbabaabaaabaababaabbaabababaaabaaabbbaaaababababbaababaabbbbbbbbaaabbabbaabbabaaabbbabbbaaaabaaab
output:
110
result:
ok single line: '110'
Test #23:
score: 0
Accepted
time: 1ms
memory: 1576kb
input:
baaababaaaaaaabaabbaaaababbabbababbaaaabaaaaaabbbaaaabbaabaaabbbabaabbbabbabbbbaaaaaababbbabbab
output:
240
result:
ok single line: '240'
Test #24:
score: 0
Accepted
time: 1ms
memory: 1624kb
input:
baabaaabbbabaabbbbbbbbaaaaaaaaabbaabbaaaabbbbaabaaabaabaaabaaaaaaaabbbaaabaaabaaaaaaabaaaaaabbbbaaab
output:
-1
result:
ok single line: '-1'
Test #25:
score: 0
Accepted
time: 1ms
memory: 1576kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
output:
1225
result:
ok single line: '1225'
Test #26:
score: 0
Accepted
time: 1ms
memory: 1740kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
output:
1176
result:
ok single line: '1176'
Subtask #5:
score: 1
Accepted
Test #27:
score: 1
Accepted
time: 1ms
memory: 1568kb
input:
ababbaabbbababaabbbbbbbaabbbbabbbbaabbababbbbababbbabbaababaabbababaabbbaaaaaaaaabbaabbabbabbaabaabaabbabbaababbababaaabababaaabbababaaaaabbbbababaabbbbbaabaabbaaabbbbbaaaabbaababababbbaabaabaabbbbbbbababbbbbaabaaababbbaabbabaaabbbababaaabbabbabbababababbbbbabaaaabbbbaaaabbbaaabaabaaabbbaaaabaaabbab...
output:
-1
result:
ok single line: '-1'
Test #28:
score: 0
Accepted
time: 1ms
memory: 1680kb
input:
bbabbbbaabbbbbbbbaabbabbaabbbbbbbbbabbbbbabaaaaaaabbbbaabbabaabaabaaabbbaaabaabaaaabbabbabbbbaaabababaababaaabaabbbbaabbbbbabbbbaaaaaaaabaabaababbabbbababbbaabbaaabbabaaabbbaaaaabbabbbabaaaabababbbbabbaabababaabbbaaaaaababaaaaaababbbbbaaabbbaaabbbbaabbaababbbaabbbbbbbababbababaaaaababaaababbbababbbb...
output:
12146
result:
ok single line: '12146'
Test #29:
score: 0
Accepted
time: 1ms
memory: 1572kb
input:
abbabbbbabbabaabbbbabbabababbbbbabbbbbbabababaabbbbbbbbbbbbbbbbbababaababbabbbbbbabbabbbbbbbbbbbbabbbbbbbbbbbbbbbabaaabbabbbbabbbbbbbbbbbbbaabbbbbababbaababbababaabbbababbabbbabbbbbbbbbbbbbbbbbabbbbbbbbbbbbbabbbbbabbbbbbbbbaabbabbbaabbbbbbbbbbbbbbbbbababbbbbbbbbabbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbabbb...
output:
-1
result:
ok single line: '-1'
Test #30:
score: 0
Accepted
time: 1ms
memory: 1580kb
input:
ababbaabaabbbaaaaaaabaaaaaaaaaaaaaababaaaabaaaabaaaaabaaababbaaaaaaaaabababbaabaaaaaaaaaaaaaaaaaaaaaabaaaabaaaaaaaaabababaaabaaaaaaaaabbaaaabaaaaaaabaaaaaaaaaaaaaaabaabbbbaaabbaabaaaaaaabaaabaaaaaaaaaaabababaaaabaabaaabaaaaaaaaaabaaaaaaabbaababbbbaaaaaaaaaaabbaaaaaaaaabbbabaaaaaaabbaaaabaaabbaaabbba...
output:
34493
result:
ok single line: '34493'
Test #31:
score: 0
Accepted
time: 0ms
memory: 1680kb
input:
abbaaaaaaaababaaabbaaabbabaaaaaaaaaaaaaaabaaaabaaaaaabaaaaaabaaaaabaaaaaaababaaaabaaabbbaaabbaaabbaaaaaaaaaaabaaaababaaaaabaabaaaaabbaaaaaaabaaaaaaaaaaabbaaaaaaabaabbabbaaaaaaaaaaaaaaaababaaabaaaaaabbaaababaaabaaabbaaaaaaaababaaabaaaaaaaaaaabaaaaaaaaabaabaaaababbaabbaabaaaaaaaabbaaabaaaaaaaaaaaaaaba...
output:
7781
result:
ok single line: '7781'
Test #32:
score: 0
Accepted
time: 0ms
memory: 1632kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
1125000
result:
ok single line: '1125000'
Test #33:
score: 0
Accepted
time: 1ms
memory: 1676kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
-1
result:
ok single line: '-1'
Subtask #6:
score: 1
Accepted
Test #34:
score: 1
Accepted
time: 1ms
memory: 1740kb
input:
ababbabbbabaaaabaababbaabbabbbbbbabbbaaabaaabbaaababbbbabbaabbbaaaabababbbbbbbbaaabbabbabbbaaabbbbbbbaaaaaaaaaaabbbaabbbbaaaabaababbabaabbbaaaaaaababbbbbbbbaabaabbbbaabaaababbbbbababbbaabaababaabaabababbbabbaaaaaaaabaabaaaaabbbaaabbaabababaabababbaabaaaabbabaabbababaababaaaaabbaaaabaaabaabaabaabbabb...
output:
-1
result:
ok single line: '-1'
Test #35:
score: 0
Accepted
time: 1ms
memory: 1688kb
input:
baaaabaaabbbbaabaaaaabbbaabbbabbbbabbaabbbbbbaaababaabbababbababbbaabbababbbbaabaaabbbbbbabbabbabbaaababbabbaabbaaaabaabaabbbbabaaaaabbbbbaaaaabaabbaabbbbbbbabbbababaaaabaabaaaabaaaaabbbaabaabaabababababbabaabbabbbababbaabbbaaababaaaaaabbbbbbaabaaaaabaaabbbbaabbaaaabbbabaabbaaaaabbaabbabaaaabbabbbbb...
output:
8804
result:
ok single line: '8804'
Test #36:
score: 0
Accepted
time: 1ms
memory: 1628kb
input:
babaabbaabbabbbbabbbbbabbbbbbabbabbbbbbbaabbbbbbbbbbbababbbbbbbbababbbbbbbbbbaaabbbbababbbbbbabaababbabbbbbbbbbaaabbbbbbbbbbbbababbbbbabababbbbabbaabbbabbbbabbbbbbbbbbbabbbaabbbbabbbbbabbbbababbbbbbbbbbbaaaabbbbaababbbbababbaabbbbbbbbbbbbbbbbbbbabbbbaabbbaabbabbbbbbbbaabaababbabbbbbababbbbbabbbaaabb...
output:
4408
result:
ok single line: '4408'
Test #37:
score: 0
Accepted
time: 1ms
memory: 1588kb
input:
abbbbbbabaaabaabbabbbbbbbbaabbbbbbaabbabbbabbbbbaaabbbbaaabbbbbbbbbbbbbbabaabbbbbbabaabbbbbbaaaabbbabbaaababbbabaaaabbabbaaabaabbbbbbbbabbbaabaabaababbbabaabbbbbbaabbbbababbababbbaaabbbaabbabbbbbabbbbbbbbbbaababbbaabaabbbababbbabbbbabbbaabaaaabaabbaabbabbbbbaabbbaabaababaababaabbbbbabbbbabbabababbaa...
output:
13805
result:
ok single line: '13805'
Test #38:
score: 0
Accepted
time: 1ms
memory: 1680kb
input:
babbbbabbbbbbbbbbabbbbbbabbbabbabbbbbbbbbbbabbbbbbbabbbabbaabababbabaababbbbbababbbbbaaabbbbabbababbbabbbbbbbbbabbbaabbbabbbababbababbbbabbbbbaabaabbbbbaababbbabbbaaaabbbbbbbbabbabbbbbbababaabbbbbbbabbbbbaabababaabbbbbaabbabbbbbbbbaaabbabbbbbbabbbbbabbabbbabbbbbbaababbaaababbbbababbbbbabbbbababbabba...
output:
12096
result:
ok single line: '12096'
Test #39:
score: 0
Accepted
time: 0ms
memory: 1552kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
1124250
result:
ok single line: '1124250'
Test #40:
score: 0
Accepted
time: 1ms
memory: 1688kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
1122751
result:
ok single line: '1122751'
Subtask #7:
score: 1
Accepted
Test #41:
score: 1
Accepted
time: 2ms
memory: 1808kb
input:
aabbbbbbbabaaabaabaaaaababababaabbaaaaabbaabbbababaabbaaabbabababbaabbababbbababaabbbabbaabbaaaabbaabbbaabbbaabbbbbbbaabaaaabbaabababbbbbabbaabbabaaaaabaaabbaabababaababbbbbbabbaabbbabbababbabaababbbbaabbabaabbbaabbaabaaaababbbabaababaabbaabbabaababbbaabbbbaabbaaaabbbbbbaabaabaaaaaabaabaabbabbbabbbb...
output:
-1
result:
ok single line: '-1'
Test #42:
score: 0
Accepted
time: 2ms
memory: 1872kb
input:
babbaaaaabaabbbbabbbaaabaaaabbbabbbbbaaaaabaaaaaaaabbabbabbaaaaabbaaaaaaabbaabbbbbababbaabbabaaababbaabaaaabaaabababbbbbbababbbbabbbaabbaaababbbaaababaabbaaaababaaaabaaaabbabbbbbbabbaaabbbbbaabaaaabbbabbbbbaaabaabbbbbbabbaaaaabbaaabbabaabaabbabbaabaaabbabbbbaaabbaabbbbabbbabbbabbabbbabaaaaaaaabaaaba...
output:
7653087
result:
ok single line: '7653087'
Test #43:
score: 0
Accepted
time: 2ms
memory: 2024kb
input:
abaababaaaaaaaaaaaaaaabaaaaaaaaaaabbaaaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaaaabaaaaaaabaaaaaaabbaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaabaaabaaaaaaababaaaaaaaabaaaaaaaaaaaaaaaaaaabaaaabaaaaaaaaaaaaabaaaaaabaaaaaaaaaaaaaaaaabaaabaaaaaaaaaab...
output:
1284055
result:
ok single line: '1284055'
Test #44:
score: 0
Accepted
time: 2ms
memory: 2004kb
input:
aaaaaabaaaaaaaabaaaaaaaaaababaaabaaaaaaaaababaaaaaaaaaaaaaaaaabaaaaaabaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbabaaaaaaaabaaaaaaaaaaaabaaabaabaaaaaaaaaaaaaaaaaababaaaabaaaaaaaaaaaaabaaaaaababaaaaaabaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaabaaaaaaaaaabaaaaaaaaaabaaaaaaaaaaaabaaabaaaaaaaaaaaaaa...
output:
3216829
result:
ok single line: '3216829'
Test #45:
score: 0
Accepted
time: 2ms
memory: 1748kb
input:
bbbbbbabbbbabbbbbbbbbabbabbbbbbbbbbbbbbbbbaaabaabbaabbbabbbabbbbbbabbabbbbbbbbbbbbbbbbbabbabbbbbbbbbbabbbbabbbbbbbbbbbbabbbbbbabbaaababbaabbbbbbbbbbbbbabbbaaababbbbbbabbbbbbbbbbbabbbbbbbababbabaabbbbbbbbbbabbabbbbbabbbabbbabbbbbbabbabbbabbabbbbbbbbbabbbbbabaabbbbbbbbbbbbbbbbbbbbbabababbbabbbbbbbbbbb...
output:
2232371
result:
ok single line: '2232371'
Test #46:
score: 0
Accepted
time: 2ms
memory: 1652kb
input:
babbbbbbbabbbbabbbbbbbbbbbbbbabbbbbabbbbbbbbbabbbbbbbbbabbbbbbabbbbababbbbabbbbbbbbbabbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbabbbabbbbbbbbbbbbabbbbbbbbbbbbbabbbbababbbbabbbbbbbabbbbbbbababbbbabbbabbbbbbbbbbbbbbbbbbbaabbbbabbbbbbbbbbabbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbabbabb...
output:
2416821
result:
ok single line: '2416821'
Test #47:
score: 0
Accepted
time: 2ms
memory: 1628kb
input:
babbbbbbbbbbabbbabbbbbbbbbbbbbbbbbbbbbbbabbabbbbabbbbbbbbbabbabbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbaaabbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbaabbbbb...
output:
-1
result:
ok single line: '-1'
Test #48:
score: 0
Accepted
time: 2ms
memory: 1688kb
input:
babbaabaabbababbabbbaaaaaababababaaabbabaabaabaabbaaaabbbbbaabbabbbbababbabbbbbbbbbaaabbbbbaaaaabbaaaaaaaaabbbabbbabaabaabbbaaabaabababaababaaabbbaaababaabababbbbaabbbbabaabaaaaaaaaaaabaaaaaaaaaaabbbbabaabbbbaabbabaaaaabbaaaaabaabbabaabbbbabbaaaabbaaaaaaabbbabbbabbabbababaabaaaababbaabbbaabbbbababab...
output:
0
result:
ok single line: '0'
Test #49:
score: 0
Accepted
time: 2ms
memory: 1808kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
1250000000
result:
ok single line: '1250000000'
Test #50:
score: 0
Accepted
time: 2ms
memory: 1792kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
-1
result:
ok single line: '-1'
Subtask #8:
score: 1
Accepted
Test #51:
score: 1
Accepted
time: 0ms
memory: 1804kb
input:
bbaabbbaabbbbbbaaabaabbabbaaabbaabaabbbaabbbbaababbaaaaababbabbbbaaaabbbabbbbbbbbbbaababaaababbabababbbabbaabbababbbbbabbbabbaaaaaabbabbbbbbbaabababbbaabaababbbbbabbababaababbbbbabaaaabbbbaaabababaababaaaaabbabaaababababbababaaaaabbaaababaaabaabaaabbbbbbababbbbaabaaababbabaabaabbabababaaaabaabbaaabb...
output:
5352746
result:
ok single line: '5352746'
Test #52:
score: 0
Accepted
time: 2ms
memory: 1852kb
input:
abaaababbbbbaababbabaabbbabbbbbbaaabbbaabbaababababababbaaabaabababbaabbabbbabbabbbbbbabababbabaabbbabbbabbbbaabbbabaababbaabababbaababababbabbbaaaaaaabaabbbbaaaaabaababaabbaaaaabbaaabbaabbbbabbbbbbaaabbaaaaabbabbaabaaaaabaaaabbabbbabbabbbbbbbbbaabbbabaaabbbbbbaaaaabbabbbaabbbabbabaaababbaabaabaaaba...
output:
3507753
result:
ok single line: '3507753'
Test #53:
score: 0
Accepted
time: 2ms
memory: 1952kb
input:
aaaaabaaaaaaaaaaaaaaaaabaaaaaaaabaaaaaaaaaaaaabbbaaaaaaaaaaaaaabbabaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaabaaaaaaaaaabaaaaaaaaaaaaaabaaaaabaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaabbabaaabaaaaaabaaaaaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab...
output:
-1
result:
ok single line: '-1'
Test #54:
score: 0
Accepted
time: 2ms
memory: 1740kb
input:
bbabaaabbbbbabbbabbbbbbbbaaabbbababbabbbbbbbbbabbbbbaabbbbbababbbababbabbabbbbabababbbabbbbbbbbbabbabbbbbbaabbabbbbbbbbbabbbbbabbababbbbbabbabbabbabaabbbbbbabbbbabbbaaabaaabbabbbbbbabaababbabbbaabababbbbbabbabbbbbbbbabbbbbbabbbabbbbbbbbbaabbbaabbbbbbbbbbbbbbbbababababbbabbbbbaaabbbbabbabbaabbbababbb...
output:
-1
result:
ok single line: '-1'
Test #55:
score: 0
Accepted
time: 2ms
memory: 1684kb
input:
abbabbaabbbaabbbabaaabaaaabaababbbabaaaababbaabababbaabbababbaaababababababbbabbabbbabababaabaaaaabbabaabaaaabbbbabbaababaabaabbaababaababbabaaababaabbbbabbbbbaabbababaaaaabaaabbaabababbaabbaabbbababbbabaababbabababbbbbabaaaabbbbbabbabbaaaaaaabaaaaabbbababaaabbbabaaaaabbbbbabbaaaabbaabbabbbabbbbbbaa...
output:
-1
result:
ok single line: '-1'
Test #56:
score: 0
Accepted
time: 2ms
memory: 1676kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
154526
result:
ok single line: '154526'
Test #57:
score: 0
Accepted
time: 2ms
memory: 1612kb
input:
bbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
-1
result:
ok single line: '-1'
Test #58:
score: 0
Accepted
time: 2ms
memory: 1860kb
input:
bbbabbaabbbbaabbbbabbaabbbabababbabbbaabbbbbabbbabababbbbababbbbaaabbbbabbaabbbbababbbabbbbabbbabbbbaaabbbaabaabaaaaaababaaaababbbbbabbabbbbaabbbababbbaabbbaabbaaababbaaaaababbaaaababaabaababaaaabbbbbaaababaaaabaabbbbabbbaaaabbbabaaaaabbbababbabababbaabbabaabaaabbaaaabbbababbbbbabbbbaaaabbabaaaaabba...
output:
0
result:
ok single line: '0'
Test #59:
score: 0
Accepted
time: 2ms
memory: 1672kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
1249975000
result:
ok single line: '1249975000'
Test #60:
score: 0
Accepted
time: 2ms
memory: 1676kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
1249925001
result:
ok single line: '1249925001'
Subtask #9:
score: 1
Accepted
Test #61:
score: 1
Accepted
time: 1ms
memory: 2152kb
input:
abaaaaaababbabbaaaabaaabbbbbbabaaabbaaabbbabaabbaabbaabbbaaababbaabbbabbabbbaaabbbabaabbbbbaababaaabaabaabbabbbabbaabaababaabbbabbbbaabababbbaaababbbbaabbbbabbaabababaabababbaaabbbbaaaaabbabbbababababaabababaaabaaaaaaabababbabbabaabaababbbabbaababaaaabaaaabbabbaabaabbababbbbbabbbabbaaaaabaaaabbaabab...
output:
25942642
result:
ok single line: '25942642'
Test #62:
score: 0
Accepted
time: 4ms
memory: 2044kb
input:
baabbabbbbbbaabbabbaababbaabbbbaaababaaaaabbabbbaabbaaabaaaababaabbaabaabbabbbabaabaabbabaaabaabbabbabbbababaaabbbabaabababaaaaaaababbbbbaabbaaaaaaaaaabaaabababbbaababbbaabbababbaabbbabbbbabbaabbabbbbaaabbaaababaabaabaabbbabbaaababbbabaababbbbbbbabbabababbaaabbbbaaabbaaabbabaabaabbbaaabaaabababbabab...
output:
8020029
result:
ok single line: '8020029'
Test #63:
score: 0
Accepted
time: 2ms
memory: 1816kb
input:
abbbbbbbbbabbabababbaaabbbbbababbabbbaaabbbababbbbaaabaaabaabbbbabbabbbabbabbabbabbabaabbbbabbbabaababbbbbabbabaabbbbbbbbbbbbbbaaabbbbabbabbababbbabbbabaabbabbbbbbabbbbbbabbbbbbabaabbbabbbbbbabbbaababbbabbbbabbbbbbbaabbbbbbabbbbbababbbbbbbbbbbbabbabbbbbabbababbbbbaaabbbbbbbbabbbbaabbbababaabbbabbbab...
output:
-1
result:
ok single line: '-1'
Test #64:
score: 0
Accepted
time: 4ms
memory: 2392kb
input:
aaabbaaaaaaabaaaaaaaaaaaaaabaabaaabaaaaabaaaaaabaaaabbaabaabaaaabaabaaaaaaabaaaaabaaaaaaaaaaabaaabaaaaaaaaaaaaaaabaaaaaaaaaaaabbaaaaababbaaaaaabaaaaabaaaaaaaaaaaabaaaaaaaabababaaaaabaabaaabaaaaaabaaaaaaabaaaaaaaaaaaaaabaaaaaabaabbaabaaaaaaaaaabaaabaabaabaaabaabaaaaaaaaabaaaabaaaaaaaaaaaaaaaaabaaaaaa...
output:
9848862
result:
ok single line: '9848862'
Test #65:
score: 0
Accepted
time: 1ms
memory: 1888kb
input:
bbbbbbabbbbbbbbababbababbbbbbbbbbbbbbbbbbbbababbbbbabbbbabaabbbbbabbabbabbbababbabbbbaaabaaabbbbabbbbbbaabbbbbbabbbbababbbbbbbbbbabbbbbabbaaabbbbabbabaabbabaababbababbbbbbbaabbabbabbbabbbabbbbbbbbbaabaabbaabbbbbbaabaabbabababbbbaabbbabababbbabaaabaabababbababbaabbbbbbabbbbbabbbbbbbaabaaabbbbbababbab...
output:
-1
result:
ok single line: '-1'
Test #66:
score: 0
Accepted
time: 3ms
memory: 1688kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
-1
result:
ok single line: '-1'
Test #67:
score: 0
Accepted
time: 3ms
memory: 1584kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
583534
result:
ok single line: '583534'
Test #68:
score: 0
Accepted
time: 1ms
memory: 1660kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
0
result:
ok single line: '0'
Test #69:
score: 0
Accepted
time: 4ms
memory: 2104kb
input:
aaaaaaabaaabbbbbbbbaabbbbaaaababababbaabababbbbaabbaaaabbbaaabababaaabbbbaaaababaabbbbbbbbaabbbaabaabbaaaabbaabbabaaabaabaababbbaaaaaaabbbbabbbbbbaabbbabbbabbaababbabbabbaaabbbbbbbbbaaabaaabbababbbabbbaabbaaaaabaaaaabbababaabbbabbabbbaababbbaabbbbbbabababbbaaabaabaabbaaabababaabbabbabaabbaaaaabbabba...
output:
0
result:
ok single line: '0'
Test #70:
score: 0
Accepted
time: 1ms
memory: 2156kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
5000000000
result:
ok single line: '5000000000'
Test #71:
score: 0
Accepted
time: 3ms
memory: 2100kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
-1
result:
ok single line: '-1'
Subtask #10:
score: 1
Accepted
Test #72:
score: 1
Accepted
time: 4ms
memory: 2108kb
input:
abaaabbbbbbbbaababbabbbbababababbbbbbaabaaaaabbabababaaababbbbaaabaabababbaabaabaaabaabaabbaaabbaaaabaaaabbabbbaaaaabbbbbabaabbbaaaaabbbabaaabbbaaaaaaabbbbabbaabbabbbaabaaaababaaaaaaabbabaaabbbababaababaaaabbaabababaaabaaaabababaaaabbbbbbaaabaaabbbbbabbbbbabbabaabbbaabbbababaabbababbaaabbabbbabbbbaa...
output:
4943647
result:
ok single line: '4943647'
Test #73:
score: 0
Accepted
time: 4ms
memory: 2108kb
input:
baaabbabaaaaabbbbaabbabaabaaababbaababababbbaabbbabbbabbabbabbaabbbababbbbabbabbabbabbbabbaaabbabaabbbbbbbaabbabababaabaabbaabaaabbaaaabaaabbbbaaabaabbbabababbaabbabbaabbabbbaabaaaabaaabaaaababaababbbaaaaaabaabababbbbbaababaaabbbaaabbabbabbaaaaabababaaabbbbbabbaaaaaaaababbababbaaaaabbabaaaaababbbabb...
output:
9958129
result:
ok single line: '9958129'
Test #74:
score: 0
Accepted
time: 4ms
memory: 2436kb
input:
aaabaaaaaaaaaaaaaaaaabaaaaabaaabaaaabaaaaaaaaabaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaabaaabaabaaaaaaaaaaababaaaaaaaaabaaaaaaaaaaaababaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaabbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaabaaaaaaaaaaaaabaaaaaaabaabaaaaaaaaaa...
output:
7071826
result:
ok single line: '7071826'
Test #75:
score: 0
Accepted
time: 1ms
memory: 1924kb
input:
bbbabbbaabbaaaabbabbabbbaabbababbababbaaabbaaabbbbbabbbabbabbbbbaaabbbbaabbababbbaaabbababbbbabbabbabbbbbbbabbbbbabaabbbabbbabbababbbbbbbabbbbbbbaaabbbbbbbabbbbbbabaaaabaabbaabbbbbaabbabbbabbabbbbbbabbbbaabbbabbbabbbbbabbbabbbbbbbbbabababbbbbbbbbbbabbbbababbbabaabbbbbabbabbbbbbbbbaabbabbbbbbbabbbbab...
output:
-1
result:
ok single line: '-1'
Test #76:
score: 0
Accepted
time: 3ms
memory: 1836kb
input:
bbbabaababbabbbbbbbbabbbbbabbabbbbbabbbbbbbbbbbbabbbbbbbbbaabbbabbbbbbbbbabbbbabbbbbbbbbbbabbbbbbbbbbababbaabbbabbaabbabbbbbbbbbbbbbbbbabaaaabbbbbbbbbbbbbbbabbbabbbbbbabbbbbbbbbbbbbaababbabbbbabbbbbbbbbabbabbabbbabbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbababbbbbbabbbbbbbabbbbbabbbbbbbbbbbbbbbbbabbbbbbbbabbb...
output:
9665302
result:
ok single line: '9665302'
Test #77:
score: 0
Accepted
time: 3ms
memory: 2552kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
143949
result:
ok single line: '143949'
Test #78:
score: 0
Accepted
time: 3ms
memory: 2492kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
151198
result:
ok single line: '151198'
Test #79:
score: 0
Accepted
time: 3ms
memory: 2476kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
0
result:
ok single line: '0'
Test #80:
score: 0
Accepted
time: 4ms
memory: 2076kb
input:
abbbaaaaaaaaabaabbbabbbaaababbbbababbbbabbbbbaaaaaabbaabaaaabaabaababbbbbbbbaabbaabbbaaababaaaababaaaaabbabbbbaabaaaaaabbbbababaabbabaabaabbaabbbaaabaabaabbbbaabbaaabbbababababbbaabaabbbbababaaaaabbabbaabaaabbbabbaaaaaaabbbbbbabbaabaabbbbabbabaaababbbabababbaababababaabbbbbaaabaabbbaabbaaaaaaabaaaab...
output:
0
result:
ok single line: '0'
Test #81:
score: 0
Accepted
time: 3ms
memory: 2080kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
4999950000
result:
ok single line: '4999950000'
Test #82:
score: 0
Accepted
time: 0ms
memory: 1976kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
4999850001
result:
ok single line: '4999850001'
Extra Test:
score: 0
Extra Test Passed