QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#122693 | #6635. Strange Keyboard | installb# | Compile Error | / | / | C++14 | 2.0kb | 2023-07-10 22:17:29 | 2023-07-10 22:17:32 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-07-10 22:17:32]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-07-10 22:17:29]
- 提交
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int long long
const int INF = 0x3f3f3f3f3f3f3f3f;
string s[5005];
int len[5005];
int f[5005],g[5005];
// trie
int rt,tot;
int ch[27][2000005],val[2000005];
void solve(){
rt = 1; tot = 1;
int n,k;
cin >> n >> k;
for(int i = 0;i < k;i ++) len[i] = INF;
len[0] = 0;
for(int i = 1;i <= n;i ++){
cin >> s[i];
int l = s[i].length();
len[l % k] = min(len[l % k],l);
}
for(int i = 0;i < k;i ++) f[i] = INF;
f[0] = 0;
for(int i = 1;i < k;i ++){
for(int j = 0;j <= 3 * i;j += i){
f[(j + i) % k] = min(f[(j + i) % k],f[j % k] + len[i]);
}
}
for(int i = 0;i < k;i ++) cout << len[i] << " \n"[i == k - 1];
for(int i = 0;i < k;i ++) cout << f[i] << " \n"[i == k - 1];
for(int i = 1;i <= n;i ++){
int l = s[i].length();
int now = rt;
for(int j = 0;j < l;j ++){
int x = s[i][j] - 'a';
if(!ch[x][now]) ch[x][now] = ++ tot;
now = ch[x][now];
int d = (k - (l - j - 1) % k) % k;
val[now] = min(val[now],(f[d] + l - (j + 1)) / k);
}
}
string t;
cin >> t;
int lt = t.length(); t = ' ' + t;
g[0] = 0;
for(int i = 1;i <= lt;i ++) g[i] = INF;
for(int i = 0;i < lt;i ++){
int now = rt;
for(int j = i + 1;j <= lt;j ++){
int x = t[j] - 'a';
if(!ch[x][now]) break;
now = ch[x][now];
g[j] = min(g[j],g[i] + val[now]);
}
}
if(g[lt] == INF) g[lt] = -1;
cout << g[lt] << '\n';
// clear
for(int i = 1;i <= tot;i ++){
for(int j = 0;j < 26;j ++) ch[j][i] = 0;
val[i] = INF;
}
}
signed main(){
ios::sync_with_stdio(false);
memset(val,0x3f,sizeof(val));
int TC;
cin >> TC;
while(TC --){
solve();
}
return 0;
}asdasd
詳細信息
answer.code:85:2: error: ‘asdasd’ does not name a type 85 | }asdasd | ^~~~~~