QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#593293#7700. Split DecisionsfengWA 0ms3756kbC++201.1kb2024-09-27 13:07:302024-09-27 13:07:30

Judging History

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

  • [2024-09-27 13:07:30]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3756kb
  • [2024-09-27 13:07:30]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define ll long long
#define endl '\n'
#define PII pair<int,int>
using namespace std;
const int maxn = 1e5;
vector<vector<string> > t(25, vector<string>());
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	//cout << fixed << setprecision(2);
	int n; cin >> n;
	for (int i = 0; i < n; ++i) {
		string s; cin >> s;
		t[s.size()].push_back(s);
	}
	int ans = 0;
	for (int i = 3; i <= 20; ++i) {
		map<pair<string,int>, int> m;
		for (int j = 0; j < t[i].size(); ++j) {
			for (int k = j + 1; k < t[i].size(); ++k) {
				for (int pos = 0; pos < i - 1; ++pos) {
					string s1 = t[i][j];
					string s2 = t[i][k];
					if (s1.substr(0, pos) == s2.substr(0, pos) && s1.substr(pos + 2, i - pos - 2) == s1.substr(pos + 2, i - pos - 2)) {
						if (s1[pos] == s2[pos]) continue;
						if (s1[pos + 1] == s2[pos + 1]) continue;
						m[{s1.substr(pos, 2) + s2.substr(pos, 2), pos}]++;
						m[{s2.substr(pos, 2) + s1.substr(pos, 2), pos}]++;
					}
				}
			}
		}
		for (auto p : m) {
			if (p.second == 1) {
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3756kb

input:

5
CELL
GULL
GUSH
HALL
HASH

output:

0

result:

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