QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#610669#7700. Split DecisionsxyyyWA 16ms53776kbC++171.3kb2024-10-04 16:54:062024-10-04 16:54:07

Judging History

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

  • [2024-10-04 16:54:07]
  • 评测
  • 测评结果:WA
  • 用时:16ms
  • 内存:53776kb
  • [2024-10-04 16:54:06]
  • 提交

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][30];
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][pos]++;
        tot=max(sum,tot);
    }
    int ans=0;
    for(int i=1;i<=tot;i++)
    for(int j=1;j<=25;j++){
        if(c[i][j]==1)ans++;
    }
    cout<<ans;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 5ms
memory: 9972kb

input:

5
CELL
GULL
GUSH
HALL
HASH

output:

2

result:

ok single line: '2'

Test #2:

score: -100
Wrong Answer
time: 16ms
memory: 53776kb

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:

3232

result:

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