QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#797040#1369. Longest Common SubsequencedebianWA 1ms3628kbC++14475b2024-12-02 14:53:452024-12-02 14:53:45

Judging History

你现在查看的是最新测评结果

  • [2024-12-02 14:53:45]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3628kb
  • [2024-12-02 14:53:45]
  • 提交

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'