QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#260462#7700. Split DecisionsItsJerr#AC ✓231ms43108kbC++201.0kb2023-11-22 10:41:032023-11-22 10:41:04

Judging History

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

  • [2023-11-22 10:41:04]
  • 评测
  • 测评结果:AC
  • 用时:231ms
  • 内存:43108kb
  • [2023-11-22 10:41:03]
  • 提交

answer

/*input
5
CELL
GULL
GUSH
HALL
HASH
*/
#include <bits/stdc++.h>

using namespace std;
const int N = 2000;
string s[N];
int main() {
	cin.tie(0)->sync_with_stdio(0);
	int n;
	cin >> n;
	for (int i = 1; i <= n; ++i)
		cin >> s[i];
	int ans = 0;

	map<pair<string,int>, int> Map;

	for (int j = 0; j < 19; ++j)
	{
		Map.clear();
		for (int i = 1; i <= n; ++i)
		{
			for (int p = i + 1; p <= n; ++p)
			{
				if (s[i].size() - 1 < j + 1) continue;
				if (s[i].size() != s[p].size()) continue;
				int Dif = 0;
				for (int o = 0; o < s[i].size(); ++o) if (s[i][o] != s[p][o]) ++Dif;
				if (Dif != 2) continue;
				if (s[i][j] != s[p][j] && s[i][j + 1] != s[p][j + 1])
				{
					string z = "", x = "";
					z = z + s[i].substr(j, 2) + s[p].substr(j, 2);
					x = x + s[p].substr(j, 2) + s[i].substr(j, 2);
					Map[make_pair(z,s[i].size())]++;
					Map[make_pair(x,s[i].size())]++;
				}
			}
		}
		for (auto h : Map) if (h.second == 1) ++ans;




	}
	cout << ans / 2 << '\n';
	return 0;
}

详细

Test #1:

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

input:

5
CELL
GULL
GUSH
HALL
HASH

output:

2

result:

ok single line: '2'

Test #2:

score: 0
Accepted
time: 13ms
memory: 3500kb

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: 3460kb

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: 3468kb

input:

4
ABCD
AEFD
AGHD
AIJD

output:

6

result:

ok single line: '6'

Test #5:

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

input:

3
ABABA
AABBA
ABBAA

output:

2

result:

ok single line: '2'

Test #6:

score: 0
Accepted
time: 1ms
memory: 3448kb

input:

3
AAAAA
ABBAA
AABBA

output:

2

result:

ok single line: '2'

Test #7:

score: 0
Accepted
time: 1ms
memory: 3508kb

input:

8
ABBA
ACCA
AABB
AACC
DBBD
DCCD
EEBB
EECC

output:

0

result:

ok single line: '0'

Test #8:

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

input:

6
ABBA
ACCA
AABB
AACC
DBBD
DCCD

output:

1

result:

ok single line: '1'

Test #9:

score: 0
Accepted
time: 1ms
memory: 3556kb

input:

4
ABBA
ACCA
AABB
AACC

output:

2

result:

ok single line: '2'

Test #10:

score: 0
Accepted
time: 1ms
memory: 3500kb

input:

4
ABBA
ACCA
ABBAA
ACCAA

output:

2

result:

ok single line: '2'

Test #11:

score: 0
Accepted
time: 1ms
memory: 3504kb

input:

100
CCBAEADDE
CABCDE
EDBCBEC
BAEE
EDADBBEBA
BCAEC
EABCE
ADECB
BEACCDECB
DEDE
BADDDAE
BBBADBAED
CDEBBC
CAADCDEE
EECD
EAAAABA
EAADAAC
DDBACADDB
DCCCCCB
AADEDBC
ACBAACBDB
CDAAACCBC
EEDCB
CCEEBCEEE
AEAABE
BEDEAAACB
DAECDB
CACBBEB
ABEBED
ECEDAEE
EDCEBBBADB
BEACE
EDBAADAE
AABADC
EBAA
CDED
ADABEA
CBACCBC
A...

output:

4

result:

ok single line: '4'

Test #12:

score: 0
Accepted
time: 1ms
memory: 3544kb

input:

20
AABCC
BADCCCBA
ADCEECBB
DAEEDCB
EAAC
CDCEAEADC
ADBBCDBBCA
BBCABBECAE
CEBAEAEB
CCAAB
EEDADEEB
EADA
CBBEA
ABBDDCC
BABADDA
AEBDBCDBAD
ACCCDDEAB
AEDADEBA
BCDED
DBAB

output:

1

result:

ok single line: '1'

Test #13:

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

input:

250
AEGDGEAB
GGEG
BEEFFEDDF
BBCA
EGBC
BABFDDAFA
GGACGCCCBD
DBFBF
DDDCDG
FAGAED
FFBBAFCBF
EAAEEEAAB
GDAGBA
AEBFFAD
EGBGBBAAA
FFGEGC
DDBGAGADB
EDEBB
EABGBGF
EFBEDBGD
BFGGD
CDGB
CCEGABGFGB
ACEFGEEBA
GDAC
GCEDAFBBA
BFEFAFBGAA
AEGD
GGEACB
CEFBGFAA
GAADFG
ADBD
EABBGA
FFFCE
FDEGGFAAD
AEEFBEE
DCDCFFBD
ACFDC...

output:

39

result:

ok single line: '39'

Test #14:

score: 0
Accepted
time: 1ms
memory: 3432kb

input:

30
CEBCBABB
EADCEC
CADEDDCBBB
CAAE
BBDCCEBEEA
DBABADCAAA
ACCDCECE
CBBEDCCECA
EACDDBB
ECCCCDB
BCDBDAECA
DABD
BECDAEE
ACCBEBEA
BBBDCBEAE
DACCEDB
BEEDBDB
ABBAACCDAA
DCBEB
EECB
ADEE
ADEBCEDCBB
ADADAECE
DBCBD
BBBE
AEDEA
AEAADD
EAAEBE
EBBA
ABCA

output:

0

result:

ok single line: '0'

Test #15:

score: 0
Accepted
time: 1ms
memory: 3456kb

input:

40
CABBD
BAABEA
ADAEABCD
BDCDEECACB
DBABEB
ECDBAAEE
EDABABCEAB
DBEADCADAC
BBEBADBCC
AADEBBCB
CBAAACBEAE
BDAC
DCDCACD
BACABDBCCA
CEBEEEDDB
BACC
AEABCAAC
ABECDDDDBC
CADECB
EAAAAAAE
BDBECEEDBC
AECB
CABAECCE
BCBAA
DCCEBB
ECCBEEC
EECBEABE
CDEAD
DBABA
BDAAED
BCDEBCADEC
BBCDBCAB
EBDAE
DEEACCB
ECACDAA
BCBCC...

output:

1

result:

ok single line: '1'

Test #16:

score: 0
Accepted
time: 1ms
memory: 3492kb

input:

7
ABC
AEF
BAB
BEF
ABA
ACA
AAB

output:

7

result:

ok single line: '7'

Test #17:

score: 0
Accepted
time: 2ms
memory: 3460kb

input:

642
AARON
ABANDONED
ABERDEEN
ABILITIES
ABILITY
ABLE
ABORIGINAL
ABORTION
ABOUT
ABOVE
ABRAHAM
ABROAD
ABSENCE
ABSENT
ABSOLUTE
ABSOLUTELY
ABSORPTION
ABSTRACT
ABSTRACTS
ABUSE
ACADEMIC
ACADEMICS
ACADEMY
ACCENT
ACCEPT
ACCEPTABLE
ACCEPTANCE
ACCEPTED
ACCEPTING
ACCEPTS
ACCESS
ACCESSED
ACCESSIBILITY
ACCESSIBLE...

output:

240

result:

ok single line: '240'

Test #18:

score: 0
Accepted
time: 231ms
memory: 43108kb

input:

1499
AAAAAAAAAA
AAAAABAAAA
AAAAACAAAA
AAAAADAAAA
AAAAAEAAAA
AAAAAFAAAA
AAAAAGAAAA
AAAAAHAAAA
AAAAAIAAAA
AAAAAJAAAA
AAAAAKAAAA
AAAAALAAAA
AAAAAMAAAA
AAAAANAAAA
AAAAAOAAAA
AAAAAPAAAA
AAAAAQAAAA
AAAAARAAAA
AAAAASAAAA
AAAAATAAAA
AAAAAUAAAA
AAAAAVAAAA
AAAAAWAAAA
AAAAAXAAAA
AAAAAYAAAA
AAAAAZAAAA
AAAABAAAA...

output:

211250

result:

ok single line: '211250'