QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#610373#7700. Split DecisionsxyyyWA 9ms4080kbC++171.0kb2024-10-04 15:45:172024-10-04 15:45:18

Judging History

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

  • [2024-10-04 15:45:18]
  • 评测
  • 测评结果:WA
  • 用时:9ms
  • 内存:4080kb
  • [2024-10-04 15:45:17]
  • 提交

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;
			{
				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: 3776kb

input:

5
CELL
GULL
GUSH
HALL
HASH

output:

2

result:

ok single line: '2'

Test #2:

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

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'