ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#210928 | #2069. 组合技 | shiruiheng | 20 | 0ms | 1208kb | C++11 | 783b | 2024-08-08 11:02:17 | 2024-08-08 12:39:34 |
answer
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
//using LL = __int128
#define pi pair<ll, ll>
#define N 1111
ll n, m, a[N], nxt[N], len[N], v[N];
char s[N][N];
int main(){
scanf("%lld%lld", &m, &n);
for(int i = 1 ; i <= n ; i++){
scanf("%s%lld", s[i] + 1, &a[i]);
}
if(n == 1){
n = strlen(s[1] + 1);
for(int i = 2 ; i <= n ; i++){
int x = nxt[i - 1];
while(x && s[1][x + 1] != s[1][i]){
x = nxt[x];
}
if(s[1][i] == s[1][x + 1])
nxt[i] = (x + 1);
else
nxt[i] = 0;
}
if(n > m){
puts("0");
return 0;
}
ll ans = a[1], use = n, add = n - nxt[n];
while(use + add <= m)
ans += a[1], use += add;
printf("%lld", ans);
return 0;
}
if(m <= 10){
return 0;
}
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 1180kb
input:
10 10 BA 476 BA 463 AAABAAX 2044 BBAXXA 934 B 128 BAXBB 886 AXB 784 AXABX 917 XXXABBA 905 XB 343
output:
result:
wrong answer Unexpected EOF in the participants output
Subtask #2:
score: 20
Accepted
Test #4:
score: 20
Accepted
time: 0ms
memory: 1200kb
input:
1000 1 BABBXXBXBBABBXBBXXAAAAXBXXBXXXXXAAAAAAXXABBBB 13224
output:
290928
result:
ok "290928"
Test #5:
score: 0
Accepted
time: 0ms
memory: 1204kb
input:
1000 1 XBBXBXB 1019
output:
202781
result:
ok "202781"
Test #6:
score: 0
Accepted
time: 0ms
memory: 1200kb
input:
1000 1 AXXXXAX 1317
output:
262083
result:
ok "262083"
Test #7:
score: 0
Accepted
time: 0ms
memory: 1200kb
input:
1000 1 XAXAXAA 1944
output:
276048
result:
ok "276048"
Test #8:
score: 0
Accepted
time: 0ms
memory: 1204kb
input:
1000 1 AXXXXXXXAA 2626
output:
291486
result:
ok "291486"
Test #9:
score: 0
Accepted
time: 0ms
memory: 1204kb
input:
1000 1 XAXXAXXAXAAAAAAAAXXAXAAAAXAAXAAAXXAXXAAAXAAAAAXAXXXAAXXXXXAAAAAXXXAXXXAXAXXAXAAXAAAXXAAAXXAAA...
output:
261282
result:
ok "261282"
Test #10:
score: 0
Accepted
time: 0ms
memory: 1208kb
input:
1000 1 AXXAXXAXAXAXXAXXAXAXAXXAXXAXAXAXXAXXAXAXAXXAXXAXAXAXXAXXAXAXAXXAXXAXAXAXXAXXAXAXAXXAXXAXAXAXX...
output:
3135384
result:
ok "3135384"
Test #11:
score: 0
Accepted
time: 0ms
memory: 1208kb
input:
1000 1 AXXAXXAXAXAXXAXXAXAXAXXAXXAXAXAXXAXXAXAXAXXAXXAXAXAXXAXXAXAXAXXAXXAXAXAXXAXXAXAXAXXAXXAXAXAXX...
output:
4406220
result:
ok "4406220"
Subtask #3:
score: 0
Wrong Answer
Test #12:
score: 0
Wrong Answer
time: 0ms
memory: 1172kb
input:
1000 2 AXAXAAAXXX 1808 AXXAXXAXX 2462
output:
result:
wrong answer Unexpected EOF in the participants output
Subtask #4:
score: 0
Skipped
Subtask #5:
score: 0
Skipped