QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#610388#7700. Split DecisionsxyyyWA 9ms4304kbC++171.0kb2024-10-04 15:48:192024-10-04 15:48:23

Judging History

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

  • [2024-10-04 15:48:23]
  • 评测
  • 测评结果:WA
  • 用时:9ms
  • 内存:4304kb
  • [2024-10-04 15:48:19]
  • 提交

answer

#include<iostream>
#include<vector>
#include<algorithm>
#include<vector>
#include<string>
#include<cstring>
#include<queue>
#include<map>
using namespace std;
#define int long long
#define endl "\n"
map<pair<string,string>,int>idx;
void solve(){
	int n;
	cin>>n;
	vector<string>arr(n+1);
	for(int i=1;i<=n;i++){
		cin>>arr[i];
	}
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			if(arr[i].size()!=arr[j].size())continue;
			else {
				int cnt1=0;
				int pos=-1;
				for(int k=0;k<(int)arr[i].size()-1;k++){
					if((arr[i][k]!=arr[j][k])&&(arr[i][k+1]!=arr[j][k+1])){
						cnt1++;
						pos=k;
					}
				}
				if(cnt1!=1)continue;
				pair<string,string>t;
				t.first=arr[i].substr(pos,2);
				t.second=arr[j].substr(pos,2);
				// if(t.first>t.second)swap(t.first,t.second);
				idx[{t.first,t.second}]++;
			}
		}
	}
	int ans=0;
	for(auto t:idx){
		if(t.second==1)ans++;
	}
	cout<<ans<<endl;
}

signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t;
	solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
CELL
GULL
GUSH
HALL
HASH

output:

2

result:

ok single line: '2'

Test #2:

score: -100
Wrong Answer
time: 9ms
memory: 4304kb

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:

3872

result:

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