QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#797040 | #1369. Longest Common Subsequence | debian | WA | 1ms | 3628kb | C++14 | 475b | 2024-12-02 14:53:45 | 2024-12-02 14:53:45 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int n,m;
int nxt[26];
char S[27];
int f[26];
signed main(){
ios::sync_with_stdio(0),cin.tie(0);
memset(nxt,-1,sizeof nxt);
cin>>n>>m;
for(int i=1;i<=n;++i){
cin>>S;
for(int msk=0,j=m;~--j;){
nxt[S[j]-'A']&=msk;
msk|=1<<(S[j]-'A');
}
}
for(int i=m;~--i;){
int a=0;
for(int j=nxt[i];j;j&=(j-1))
a=max(a,f[__builtin_ctz(j)]);
f[S[i]-'A']=a+1;
}
cout<<*max_element(f,end(f));
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3628kb
input:
6113 13 DALIBKGHEMJFC DAHLIBKGEMJFC DALIBKGEMJFHC DAHLIBKGEMJFC DALIBHKGEMJFC DALHIBKGEMJFC DHALIBKGEMJFC DALIBKGEHMJFC DAHLIBKGEMJFC DALIHBKGEMJFC DALIBKHGEMJFC DALIHBKGEMJFC DALHIBKGEMJFC DALIBKGEMJFCH DALIBKGEMJHFC DAHLIBKGEMJFC DALIBKGEMJFHC DALIBKGEMHJFC DALIBHKGEMJFC DALIBKHGEMJFC DALIBKGEMHJF...
output:
6
result:
wrong answer 1st lines differ - expected: '12', found: '6'