QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#235389#7700. Split DecisionsPhantomThreshold#WA 4ms6124kbC++20987b2023-11-02 18:32:442023-11-02 18:32:45

Judging History

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

  • [2023-11-02 18:32:45]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:6124kb
  • [2023-11-02 18:32:44]
  • 提交

answer

#include <bits/stdc++.h>
#define ll long long
//#define int long long
using namespace std;

const int maxn = 2050;

int n;
string str[maxn];

vector< pair<int,int> >pos[30];

int num[610000];

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	cin>>n;
	for(int i=1;i<=n;i++) cin>>str[i];
	
	for(int i=1;i<=n;i++) for(int j=i+1;j<=n;j++) if(str[i].size()==str[j].size())
	{
		int len=str[i].size();
		int mnd=len,mxd=-1;
		for(int k=0;k<len;k++) if(str[i][k]!=str[j][k])
		{
			mnd=min(mnd,k);
			mxd=max(mxd,k);
		}
		if(mxd==mnd+1) pos[mnd].emplace_back(i,j);
	}
	
	int ans=0;
	for(int l=0;l<20;l++)
	{
		memset(num,0,sizeof num);
		for(auto [i,j]:pos[l])
		{
			int x= (str[i][l]-'A'+1)*27+(str[i][l+1]-'A'+1);
			int y= (str[j][l]-'A'+1)*27+(str[j][l+1]-'A'+1);
			if(x>y) swap(x,y);
			int cc= x*27*27+y;
			
			if(num[cc]==0) ans++;
			if(num[cc]==1) ans--;
			num[cc]++;
		}
	}
	cout<<ans<<endl;
	
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 5992kb

input:

5
CELL
GULL
GUSH
HALL
HASH

output:

2

result:

ok single line: '2'

Test #2:

score: 0
Accepted
time: 4ms
memory: 6012kb

input:

1000
ABSALOM
ACRATIA
AKHOOND
ALIBAMU
AMUSIVE
AGONIZE
ACOCOTL
ACTINON
ABELITE
ADVISAL
ALBETAD
AMAKEBE
ANASAZI
AMUCHCO
ADDENDA
AMESITE
ALIENEE
ADRENIN
ACERATE
AKERITE
AMPELIS
ABABDEH
ALCIDAE
AGRANIA
ALASTER
AMERISM
AMILOUN
AMYGDAL
ALUNDUM
ACHOLIC
ALTHAEA
ACIDIFY
AMNESTY
ABBOTCY
AMBALAM
AMENITY
AEOLISM...

output:

621

result:

ok single line: '621'

Test #3:

score: 0
Accepted
time: 0ms
memory: 6120kb

input:

14
ALTO
AFRO
AGENT
CAMP
CHEAP
CHESS
CLAP
CORSAGE
COURAGE
EXTINCT
EXTRACT
SCENT
STEEP
CHUMP

output:

7

result:

ok single line: '7'

Test #4:

score: 0
Accepted
time: 0ms
memory: 6020kb

input:

4
ABCD
AEFD
AGHD
AIJD

output:

6

result:

ok single line: '6'

Test #5:

score: 0
Accepted
time: 3ms
memory: 6068kb

input:

3
ABABA
AABBA
ABBAA

output:

2

result:

ok single line: '2'

Test #6:

score: 0
Accepted
time: 0ms
memory: 6124kb

input:

3
AAAAA
ABBAA
AABBA

output:

2

result:

ok single line: '2'

Test #7:

score: 0
Accepted
time: 3ms
memory: 6020kb

input:

8
ABBA
ACCA
AABB
AACC
DBBD
DCCD
EEBB
EECC

output:

0

result:

ok single line: '0'

Test #8:

score: 0
Accepted
time: 3ms
memory: 5996kb

input:

6
ABBA
ACCA
AABB
AACC
DBBD
DCCD

output:

1

result:

ok single line: '1'

Test #9:

score: 0
Accepted
time: 3ms
memory: 6088kb

input:

4
ABBA
ACCA
AABB
AACC

output:

2

result:

ok single line: '2'

Test #10:

score: -100
Wrong Answer
time: 0ms
memory: 6024kb

input:

4
ABBA
ACCA
ABBAA
ACCAA

output:

0

result:

wrong answer 1st lines differ - expected: '2', found: '0'