QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#361456 | #8515. KMOP | ucup-team206# | WA | 23ms | 15304kb | C++17 | 912b | 2024-03-23 10:24:54 | 2024-03-23 10:24:55 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int n, f[N][2], len[N];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n;
string s;
for (int i = 1; i <= n; ++i) {
cin >> s;
len[i] = 1e9;
for (int j = 0; j < s.size(); ++j) {
if (s[j] != 'A' && s[j] != 'E' && s[j] != 'I' && s[j] != 'O' && s[j] != 'U' && s[j] != 'Y') continue;
len[i] = j + 1;
break;
}
}
for (int i = 1; i <= n; ++i) {
f[i][0] = 1e9;
if (len[i] <= 3) {
for (int d = 0; d + len[i] - 1 <= 2; ++d) f[i][0] = min(f[i][0], f[i - 1][d] + len[i]);
}
f[i][1] = f[i - 1][0] + 1;
f[i][2] = f[i - 1][1] + 1;
}
int ans = min({f[n][0], f[n][1], f[n][2]});
if (ans >= 1e9) cout << "*" << endl;
else cout << ans << endl;
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 5860kb
input:
3 KNUTH MORRIS PRATT
output:
4
result:
ok "4"
Test #2:
score: 0
Accepted
time: 1ms
memory: 5632kb
input:
3 KNUTH M PRATT
output:
5
result:
ok "5"
Test #3:
score: 0
Accepted
time: 1ms
memory: 5624kb
input:
3 K M P
output:
*
result:
ok "*"
Test #4:
score: 0
Accepted
time: 1ms
memory: 5692kb
input:
2 K M
output:
2
result:
ok "2"
Test #5:
score: 0
Accepted
time: 0ms
memory: 5636kb
input:
4 YOU SHOULD BE DANCING
output:
5
result:
ok "5"
Test #6:
score: 0
Accepted
time: 23ms
memory: 15304kb
input:
1000000 Y E U O I E I E E Y I I E Y E U U O A I U O Y I Y Y U A O E U I A U U I A I U A Y I E U I O Y U Y Y I E O Y E A U O O I A E I I Y U A E Y Y A O O Y A U E A O I O Y A E I U I E Y O U O I I Y E I A Y U I I Y E E U O O U A I Y A I I E O O A A I U I U O E U I E A O E A I O O Y I U U A I A Y O A ...
output:
1000000
result:
ok "1000000"
Test #7:
score: 0
Accepted
time: 2ms
memory: 6236kb
input:
1 XAJFUEEIIUOQRUJKBDJUWYSAKPTOCXEUYMYGDOKOAGKXUYPYJYALCCXMPWSAUETUHBAOAIYIGKFLGUJVVNQOANJOYIYTXYNAIKAPEIAHVHQZINSOYPJLEBIJOGNAYWFUEIFDSNLSYEXYYAYZRTEUUEFXBUMOQIYESPKYTACAUXFLYIUYIDOUGOADUHKWOHEIEYUWENJPTOOIXMGAWOYZBMLUAKSIUEUEEECSUAFILCXIOOYIIYNMGYATUAIMZUCHXAKIUVALUMFIEUWUKWFRWALUYIDEQKNAETXEWETEGA...
output:
1
result:
ok "1"
Test #8:
score: 0
Accepted
time: 11ms
memory: 8984kb
input:
333333 SNE NGO NJA JCE XMU WBE ZZO LTY RHY XZU XZY HXI ZPU FWE HLA BFE NHY ZPE WJO QVU KGY DLA BDI CSY WXU XGU GQE CTY WQU FHI KLY PCI VDO BQA WCU KQE FLA TCI PHO GDU RCO PKI HFU MVA SRA KGO JTI NNE RLU LDU DGE QVI GXE BHU CSA PMY LTU HLE MXY QFY STE WXI XPA PKE DBI GTY XVU MXO JRA RNO FZI RFI NGA Q...
output:
999995
result:
ok "999995"
Test #9:
score: 0
Accepted
time: 1ms
memory: 5596kb
input:
1 E
output:
1
result:
ok "1"
Test #10:
score: 0
Accepted
time: 0ms
memory: 5688kb
input:
1 IY
output:
1
result:
ok "1"
Test #11:
score: 0
Accepted
time: 1ms
memory: 5856kb
input:
1 DIJ
output:
1
result:
ok "1"
Test #12:
score: 0
Accepted
time: 1ms
memory: 5624kb
input:
1 PJEI
output:
1
result:
ok "1"
Test #13:
score: 0
Accepted
time: 1ms
memory: 5688kb
input:
1 IAOLG
output:
1
result:
ok "1"
Test #14:
score: 0
Accepted
time: 1ms
memory: 5628kb
input:
2 V A
output:
2
result:
ok "2"
Test #15:
score: 0
Accepted
time: 1ms
memory: 5580kb
input:
2 NI YV
output:
2
result:
ok "2"
Test #16:
score: 0
Accepted
time: 1ms
memory: 5696kb
input:
2 GJQ MIT
output:
2
result:
ok "2"
Test #17:
score: 0
Accepted
time: 1ms
memory: 5700kb
input:
2 OLOY UPIE
output:
2
result:
ok "2"
Test #18:
score: 0
Accepted
time: 1ms
memory: 5852kb
input:
2 XLFIE AMUFI
output:
2
result:
ok "2"
Test #19:
score: -100
Wrong Answer
time: 1ms
memory: 5628kb
input:
3 R F U
output:
*
result:
wrong answer 1st words differ - expected: '3', found: '*'