QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#535899#7700. Split Decisionsrotcar07WA 43ms3852kbC++14741b2024-08-28 16:19:222024-08-28 16:19:23

Judging History

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

  • [2024-08-28 16:19:23]
  • 评测
  • 测评结果:WA
  • 用时:43ms
  • 内存:3852kb
  • [2024-08-28 16:19:22]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n;
string s[1505];
map<pair<int,string>,int> z;
int main(){
    cin>>n;
    for(int i=1;i<=n;i++) cin>>s[i];
    for(int i=1;i<=n;i++)
    for(int j=i+1;j<=n;j++){
        vector<int> pos;
        for(int k=0;k<min(s[i].size(),s[j].size());k++) if(s[i][k]!=s[j][k]) pos.push_back(k);
        if(pos.size()==2&&pos[0]+1==pos[1]){
            string a="",b="";
            a+=s[i][pos[0]],b+=s[j][pos[0]];
            a+=s[i][pos[1]],b+=s[j][pos[1]];
            if(a>b) swap(a,b);
            auto &w=z[make_pair(pos[0],a+b)];
            if(!w) w=1;
            else  w=-1;
        }
    }
    int ans=0;
    for(auto x:z) ans+=max(x.second,0);
    cout<<ans<<'\n';
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3632kb

input:

5
CELL
GULL
GUSH
HALL
HASH

output:

2

result:

ok single line: '2'

Test #2:

score: 0
Accepted
time: 43ms
memory: 3680kb

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:

621

result:

ok single line: '621'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

14
ALTO
AFRO
AGENT
CAMP
CHEAP
CHESS
CLAP
CORSAGE
COURAGE
EXTINCT
EXTRACT
SCENT
STEEP
CHUMP

output:

7

result:

ok single line: '7'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3624kb

input:

4
ABCD
AEFD
AGHD
AIJD

output:

6

result:

ok single line: '6'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

3
ABABA
AABBA
ABBAA

output:

2

result:

ok single line: '2'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3572kb

input:

3
AAAAA
ABBAA
AABBA

output:

2

result:

ok single line: '2'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3844kb

input:

8
ABBA
ACCA
AABB
AACC
DBBD
DCCD
EEBB
EECC

output:

0

result:

ok single line: '0'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3852kb

input:

6
ABBA
ACCA
AABB
AACC
DBBD
DCCD

output:

1

result:

ok single line: '1'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3512kb

input:

4
ABBA
ACCA
AABB
AACC

output:

2

result:

ok single line: '2'

Test #10:

score: -100
Wrong Answer
time: 0ms
memory: 3644kb

input:

4
ABBA
ACCA
ABBAA
ACCAA

output:

0

result:

wrong answer 1st lines differ - expected: '2', found: '0'