QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#676968#7700. Split Decisionsnew_game_plus_players#WA 87ms41100kbC++141.3kb2024-10-26 07:03:112024-10-26 07:03:12

Judging History

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

  • [2024-10-26 07:03:12]
  • 评测
  • 测评结果:WA
  • 用时:87ms
  • 内存:41100kb
  • [2024-10-26 07:03:11]
  • 提交

answer

#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
int n;
char s[1511][22];
int cnt[21][26][26][26][26];
int solve(vector<string> v) {
	if(v.size()==0) return 0;
	int l = v[0].size();
	memset(cnt, 0, sizeof(cnt));
	for (int i=0; i<v.size(); i++) {
		for (int j=i+1; j<v.size(); j++) {
			vector<int> pos;
			for (int k=0; k<l; k++) {
				if (v[i][k] != v[j][k]) {
					pos.PB(k);
				}
			}
			if (pos.size()==2 && pos[0]+1==pos[1]) {
				int p = pos[0];
				cnt[p][v[i][p]-'A'][v[i][p+1]-'A'][v[j][p]-'A'][v[j][p+1]-'A']++;
			}
		}
	}
	int ans = 0;
	for (int i=0; i<v.size(); i++) {
		for (int j=i+1; j<v.size(); j++) {
			vector<int> pos;
			for (int k=0; k<l; k++) {
				if (v[i][k] != v[j][k]) {
					pos.PB(k);
				}
			}
			if (pos.size()==2 && pos[0]+1==pos[1]) {
				int p = pos[0];
				if (cnt[p][v[i][p]-'A'][v[i][p+1]-'A'][v[j][p]-'A'][v[j][p+1]-'A'] == 1) {
					ans++;
				}
			}
		}
	}
	return ans;
}

vector<string> v[22];

int main() {
	cin>>n;
	for (int i=1; i<=n; i++) {
		string s;
		cin>>s;
		int l = s.size();
		v[l].PB(s);
	}
	int ans = 0;
	for (int i=2; i<=20; i++) {
		ans += solve(v[i]);
	}
	cout<<ans<<endl;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
CELL
GULL
GUSH
HALL
HASH

output:

2

result:

ok single line: '2'

Test #2:

score: -100
Wrong Answer
time: 87ms
memory: 41100kb

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:

700

result:

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