QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#610598#7700. Split DecisionsxyyyWA 15ms4284kbC++171.1kb2024-10-04 16:34:162024-10-04 16:34:17

Judging History

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

  • [2024-10-04 16:34:17]
  • 评测
  • 测评结果:WA
  • 用时:15ms
  • 内存:4284kb
  • [2024-10-04 16:34:16]
  • 提交

answer

#include<iostream>
#include<vector>
#include<algorithm>
#include<vector>
#include<cmath>
#include<string>
#include<cstring>
#include<queue>
#include<map>
using namespace std;
int n;
char s[2000][30];
map<pair<string,string> ,int>m;
int c[1000010];
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%s",s[i]+1);
    }
    //m.clear();
    int tot=0;
    for(int i=1;i<=n;i++)
    for(int j=i+1;j<=n;j++)
    {
        int len1=strlen(s[i]+1);
        int len2=strlen(s[j]+1);
        if(len1!=len2)continue;
        int cnt=0,pos;
        for(int k=1;k<len1;k++){
            if((s[i][k]!=s[j][k])&&(s[i][k+1]!=s[j][k+1])){
                cnt++;pos=k;
            }
        }
        if(cnt!=1)continue;
        string a,b;
        a.push_back(s[i][pos]);a.push_back(s[i][pos+1]);
        b.push_back(s[j][pos]);b.push_back(s[j][pos+1]);
        if(s[i][pos]>s[j][pos])swap(a,b);
        if(m[{a,b}]==0)m[{a,b}]=++tot;
        c[m[{a,b}]]++;
    }
    int ans=0;
    for(int i=1;i<=tot;i++){
        if(c[i]==1)ans++;
    }
    cout<<ans;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
CELL
GULL
GUSH
HALL
HASH

output:

2

result:

ok single line: '2'

Test #2:

score: -100
Wrong Answer
time: 15ms
memory: 4284kb

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'