ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#210948 | #2069. 组合技 | 18112606231 | 0 | 0ms | 1224kb | C++11 | 813b | 2024-08-08 12:22:51 | 2024-08-08 12:41:53 |
answer
#include <bits/stdc++.h>
#define int long long
using namespace std;
int m,n,a[1001],ans,maxn;
unordered_map<string,int>mp;
string s;
int check(string s)
{
int res=0;
string ss;
//cout<<s<<endl;
for(int i=0;i<m;i++)
{
for(int j=1;j<=m-i;j++)
{
ss=s.substr(i,j);
res+=mp[ss];
}
}
return res;
}
void dfs(string ss)
{
if(ss.size()==m+1)
{
maxn=max(maxn,check(ss));
return;
}
dfs(ss+'A');
dfs(ss+'B');
dfs(ss+'X');
dfs(ss+'Y');
}
signed main()
{
cin>>m>>n;
for(int i=1;i<=n;i++)
{
cin>>s>>a[i];
mp[s]+=a[i];
}
if(m<=10)
{
dfs("");
printf("%lld\n",maxn);
return 0;
}
return 0;
}
Details
小提示:点击横条可展开更详细的信息
Subtask #1:
score: 0
Time Limit Exceeded
Test #1:
score: 0
Time Limit Exceeded
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:
Subtask #2:
score: 0
Wrong Answer
Test #4:
score: 0
Wrong Answer
time: 0ms
memory: 1224kb
input:
1000 1 BABBXXBXBBABBXBBXXAAAAXBXXBXXXXXAAAAAAXXABBBB 13224
output:
result:
wrong answer Unexpected EOF in the participants output
Subtask #3:
score: 0
Skipped
Subtask #4:
score: 0
Skipped
Subtask #5:
score: 0
Skipped