QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#810270 | #78. Eggfruit Cake | SGColin | AC ✓ | 2ms | 4900kb | C++20 | 1.0kb | 2024-12-11 20:50:02 | 2024-12-11 20:50:15 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int rd() {
int x = 0;
bool f = 0;
char c = getchar();
for (; !isdigit(c); c = getchar()) f |= (c == '-');
for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
return f ? -x : x;
}
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define pii pair<int, int>
#define all(s) (s).begin(), (s).end()
#define lowbit(x) ((x) & -(x))
string s;
#define N 100007
bool fl = false;
int nxt[N << 1];
int main() {
cin >> s;
for (auto x : s)
if (x == 'E') {fl = true; break;}
if (!fl) {puts("0"); return 0;}
int n = s.length();
s = " " + s + s;
for (int i = (n << 1), lst = n; i; --i) {
if (s[i] == 'E') lst = i;
nxt[i] = lst;
}
int mx; cin >> mx;
ll ans = 0;
for (int i = 1; i <= n; ++i) {
ans += max(0, mx - (nxt[i] - i));
}
printf("%lld\n", ans);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3668kb
input:
PEPEP 2
output:
6
result:
ok single line: '6'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
PPPPPPPPPPPPPPPPPPPP 10
output:
0
result:
ok single line: '0'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
EEEEEEEEEEEEEEEEEEEEE 11
output:
231
result:
ok single line: '231'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
PPPPPPPPPPPPPPPPPPPPPP 12
output:
0
result:
ok single line: '0'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
PPEEPPEPEEPPPEPEEEPEEEP 13
output:
281
result:
ok single line: '281'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
PPPPPPPPPPPPPPPPPPPPPPPP 14
output:
0
result:
ok single line: '0'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
PEEEPEEPEPPPPEEEPPPEEPPEP 15
output:
351
result:
ok single line: '351'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3988kb
input:
PEPPPEPPEEPEPPPPPEPPEPPPPE 16
output:
377
result:
ok single line: '377'
Test #9:
score: 0
Accepted
time: 2ms
memory: 4692kb
input:
PPEPPPPPPPPPPEEPPEPPPPPPEPEPPPEPPPEEPPEPEPPPEEPPPPPEPPPPPEEPEPPPPEEEPPPEPPPPEEEPEPEPPEEPPEPEEPPPEPPPPPPPPEPPEPPPPPEEPPEPEEPPPPPEPPPPEPEPPPPEPEPPPPEPEPPPPPPPEPPEEPPPEPPEPEEPPEEEEEEPEPPPEPEPPEEEEEPEPPPEEEPPEPEPPPEPPPPEEPEEPPPPEPPEPPPPPPPPPPPPEPPPEPPPPPPEPPEPPEPPPPPPPEPPEPPPEPEEPPEPEPPPPEPPPEPEEEPPPPPP...
output:
9797610
result:
ok single line: '9797610'
Test #10:
score: 0
Accepted
time: 2ms
memory: 4692kb
input:
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE...
output:
9999900000
result:
ok single line: '9999900000'
Test #11:
score: 0
Accepted
time: 0ms
memory: 4884kb
input:
EPPPPPEEPPPPPEPPEEPPEPPPPEEPPPPPPPPPPPPPPPEPPPPPPPEPPPPEPPPEEPPPPEPPEPEPEPPEPPEPPPPPPPPPPPEPPPPPPPPPEPEEPPPPPPEPPEPPPPPPPPPEPEPEPPPPPPPPPPPPPEPEEPEPEPPEPPEEPPPEEEPPEPPPPEPEEPPPPPPPPPPPEPPPPPPPEPPPPPPEPPPEPPPPEPPPPPPEPPEEEPEPPEPPPPPPPPPEEPEPPPEPPPPEEEEEPPPPPEPPEPPPPPPPPEPPEPEPPEPPPPPPEPPPPPPPEPPEPPPP...
output:
6285741
result:
ok single line: '6285741'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3984kb
input:
EPE 1
output:
2
result:
ok single line: '2'
Test #13:
score: 0
Accepted
time: 0ms
memory: 4616kb
input:
EEEPEEEEEPEEEEEPEEEPPEEEEEEEEPEEEEEEEEPEPEEPEEEEEEPPEEEEEEEPEEEEEEEEEPEEPEEEEPEEPEEPPEPEEEEPEEEPEEEEEEEEEEEEEEEEEPEEEPEEEEEEEPEPEPEPEEEEEEPEEEEEEEEEEEEEEEEEEEPPEEEEEEEEEEEEEEEEEEEEEPEPEEPEEEEPEEEEEEEEEEEEEPEEEEEEEEEEEEEEPPEEEPEPEEEPEEEEPEEEPEEPEEEEEEEEEEEEPPEEEEEEEEEEEEEEEEEEPEPEEEEEEEEEEEPEPEEEPEPE...
output:
6859883263
result:
ok single line: '6859883263'
Test #14:
score: 0
Accepted
time: 2ms
memory: 4640kb
input:
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPEPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...
output:
2441378840
result:
ok single line: '2441378840'
Test #15:
score: 0
Accepted
time: 0ms
memory: 4704kb
input:
PPPPPPPPPPPPPPPPPPPPPPPPPEPPPPPPPPPPEPEPPPPPPPPPPPEPEPPPPPPPPPPPPPPPPPPPPPPEPPPPPPPPPPPPPPEPPPPPPPPPPEEPPPPEPPPPPPPPPPPPPPPPPEPPPPPPPPPPPPPPPPPPEPPPPPPPPPPPPPPPEEPPPPPPPPPPPPPEPPPPEEPPPEPPPPPPPPPPPPPPPPPPPEPPPEPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPEPEPPPEPPPPPPPEPPPPPPPPPPPPPPPEPPPPPPPPPPPPEPPPPPPPPPEPPP...
output:
7835156010
result:
ok single line: '7835156010'
Test #16:
score: 0
Accepted
time: 2ms
memory: 4620kb
input:
EEPPEEEEPPEPPEPPPPPEPPEEEEEEEPEEEPEEEPPEPEEPEEPEEEPEEEPEPPEPEEEEPEEEPEPPPEPPPPEPEPPPEPEPEPPPEEEEPEEPPPPPEPEPEPEPEEPPEEPPEPEPPPEEPPEPPPPEPEPEEEPPPEPPEEPEPEPEEEEEEEEPPEPPPPPEEEEEEPEEPEEPPEEPPEEEEEEEEEPPPPPPEEEPEPEPEPEEEEEEPPPEEPEEPPEPPEPEEEPPEEPEEEEEEPPEPEEEPEPPPEPPEPPEEEEEPPEEPPEPEPEEPEPPEEEPEEPPEPEP...
output:
5330324036
result:
ok single line: '5330324036'
Test #17:
score: 0
Accepted
time: 0ms
memory: 4620kb
input:
EEEEEEEEEEPEEEEEEEEEPEEEEEEPEPEEEEEEEEEEEEPEEEEEEEEEEPEEEEEEEEEEEEEEEEEEEEEPEEEEEEEEEEEEEEEEEEEEEEEPEEEEPEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEPEEEEEEEEEEEEEEEEEEEEEEEPEEEEEEEEEEEEPEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEPEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE...
output:
9062395582
result:
ok single line: '9062395582'
Test #18:
score: 0
Accepted
time: 0ms
memory: 4616kb
input:
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPEPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...
output:
2481607
result:
ok single line: '2481607'
Test #19:
score: 0
Accepted
time: 2ms
memory: 4620kb
input:
EEEEEEPPEEEEEEEEEEEEEEEEEEEEPEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEPEEEPPEEEEEEEEEEEEEEEEEEEEEEEEEEEPPEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEPEEEEEEEEEEEEEEEEEEEEPEEEEEEEEEEEPEEPEEEEEEEEEEEPEEEEEEEEEEEEEEEEEEEEEEEEEPEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEPE...
output:
8294039
result:
ok single line: '8294039'
Test #20:
score: 0
Accepted
time: 2ms
memory: 4620kb
input:
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...
output:
8086241960
result:
ok single line: '8086241960'
Test #21:
score: 0
Accepted
time: 2ms
memory: 4864kb
input:
EEEEEEEEEEPEEEEPEEEEPEEEEEEPEPEEEEEEEEEEEEPPEEEEEEEEEPEEEEEEEEEEEEEEEEEEEEEPEPEEEEEPEEEEEEEEEEEEEEEPEEEEPEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEPEEEEEEEEEEEEEEEEEEEEEEEPEEEEEEEEEEEEPEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEPEEEEEEEEEEEPEEEEEEEEEEEEEEEEEEEEEPEEEEEPEEPEEEEEEEEE...
output:
8097991676
result:
ok single line: '8097991676'
Test #22:
score: 0
Accepted
time: 2ms
memory: 3920kb
input:
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...
output:
0
result:
ok single line: '0'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
PPPP 1
output:
0
result:
ok single line: '0'
Test #24:
score: 0
Accepted
time: 2ms
memory: 4624kb
input:
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE...
output:
3579500000
result:
ok single line: '3579500000'
Test #25:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
EPEP 2
output:
6
result:
ok single line: '6'
Test #26:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
EEE 1
output:
3
result:
ok single line: '3'
Test #27:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
PPP 1
output:
0
result:
ok single line: '0'
Test #28:
score: 0
Accepted
time: 2ms
memory: 4900kb
input:
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...
output:
7000050000
result:
ok single line: '7000050000'
Test #29:
score: 0
Accepted
time: 2ms
memory: 4864kb
input:
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...
output:
6500050000
result:
ok single line: '6500050000'
Test #30:
score: 0
Accepted
time: 2ms
memory: 4616kb
input:
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...
output:
5000050000
result:
ok single line: '5000050000'