QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#610637#7700. Split DecisionsxyyyWA 10ms6760kbC++171.2kb2024-10-04 16:45:402024-10-04 16:45:41

Judging History

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

  • [2024-10-04 16:45:41]
  • 评测
  • 测评结果:WA
  • 用时:10ms
  • 内存:6760kb
  • [2024-10-04 16:45:40]
  • 提交

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);
        int sum=a[0]-'A';
        sum*=26;
        sum+=a[1]-'A';
        sum*=26;
        sum+=b[0]-'A';
        sum*=26;
        sum+=b[1]-'A';
        c[sum]++;
        tot=max(sum,tot);
    }
    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: 3764kb

input:

5
CELL
GULL
GUSH
HALL
HASH

output:

2

result:

ok single line: '2'

Test #2:

score: -100
Wrong Answer
time: 10ms
memory: 6760kb

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'