QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#611732#7700. Split DecisionsxyyyWA 17ms4192kbC++171.6kb2024-10-04 22:25:292024-10-04 22:25:32

Judging History

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

  • [2024-10-04 22:25:32]
  • 评测
  • 测评结果:WA
  • 用时:17ms
  • 内存:4192kb
  • [2024-10-04 22:25:29]
  • 提交

answer

#include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<algorithm>
#include<map>
#include<tuple>
#include<array>
using namespace std;
void solve(){
	int n;
	cin>>n;
	map<tuple<int,string,string,int>,int>idx;
	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((int)arr[i].size()!=(int)arr[j].size())continue;
			else{
				int cnt1=0;
				int pos=0;
				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;
					}
				}
				string a2=arr[i].substr(min(pos+2,(int)arr[i].size()),(int)arr[i].size());
				string b2=arr[j].substr(min(pos+2,(int)arr[j].size()),(int)arr[j].size());
				string a1=arr[i].substr(0,pos-0);
				string b1=arr[j].substr(0,pos-0);
				if((cnt1!=1)||((a1!=b1)&&(a2!=b2)))continue;
				// cout<<arr[i]<<' '<<arr[j]<<endl;
				// cout<<a1<<' '<<a2<<endl;
				// cout<<b1<<' '<<b2<<endl;
				// cout<<"......"<<endl;
				string a=arr[i].substr(pos,2);
				string b=arr[j].substr(pos,2);
				if(a>b)swap(a,b);
				tuple<int,string,string,int>t={pos-0,a,b,(int)arr[i].size()-pos-2};
				// cout<<a<<" "<<b<<endl;
				idx[t]++;
			}
			
		}
	}
	int ans=0;
	for(auto t:idx){
		if(t.second==1)ans++;
		tuple<int,string,string,int>temp=t.first;
		int p1,p2;
		string a,b;
		tie(p1,a,b,p2)=temp;
		// cout<<p1<<' '<<a<<' '<<b<<' '<<p2<<endl;
	}
	cout<<ans<<endl;
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
CELL
GULL
GUSH
HALL
HASH

output:

2

result:

ok single line: '2'

Test #2:

score: -100
Wrong Answer
time: 17ms
memory: 4192kb

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:

2833

result:

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