QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#260433#7700. Split DecisionsItsJerr#WA 23ms4164kbC++20957b2023-11-22 09:44:542023-11-22 09:44:54

Judging History

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

  • [2023-11-22 09:44:54]
  • 评测
  • 测评结果:WA
  • 用时:23ms
  • 内存:4164kb
  • [2023-11-22 09:44:54]
  • 提交

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];

	map<string, int> Map;
	for (int i = 1; i < n; ++i)
	{
		for (int r = i + 1; r <= n; ++r)
		{
			if (s[i].size() != s[r].size()) continue;
			int m = s[i].size() - 1;
			string Dif = "", _Dif = "";
			int D = 0;
			for (int j = 0; j < m; ++j)
			{
				if (s[i][j] != s[r][j] && s[i][j + 1] != s[r][j + 1])
				{
					++D;
					if (D == 1)
					{
						Dif = s[i].substr(j, 2) + s[r].substr(j, 2);
						_Dif = s[r].substr(j, 2) + s[i].substr(j, 2);
						//	cout << Dif << '\n';
					}
					else
						break;
				}
			}
			if (D == 1)
			{
				++Map[Dif];
				++Map[_Dif];
			}
		}
	}
	int ans = 0;
	for (auto h : Map) if (h.second == 1) ++ans;
	cout << ans/2;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3436kb

input:

5
CELL
GULL
GUSH
HALL
HASH

output:

2

result:

ok single line: '2'

Test #2:

score: -100
Wrong Answer
time: 23ms
memory: 4164kb

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:

2656

result:

wrong answer 1st lines differ - expected: '621', found: '2656'