QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#235391 | #7700. Split Decisions | PhantomThreshold# | WA | 8ms | 6184kb | C++20 | 1008b | 2023-11-02 18:34:13 | 2023-11-02 18:34:13 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
//#define int long long
using namespace std;
const int maxn = 2050;
int n;
string str[maxn];
vector< pair<int,int> >pos[30];
int num[610000];
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cin>>n;
for(int i=1;i<=n;i++) cin>>str[i];
for(int i=1;i<=n;i++) for(int j=i+1;j<=n;j++) if(str[i].size()==str[j].size())
{
int len=str[i].size();
int mnd=len,mxd=-1;
for(int k=0;k<len;k++) if(str[i][k]!=str[j][k])
{
mnd=min(mnd,k);
mxd=max(mxd,k);
}
if(mxd==mnd+1 && mnd>=0 && mxd<len) pos[mnd].emplace_back(i,j);
}
int ans=0;
for(int l=0;l<20;l++)
{
memset(num,0,sizeof num);
for(auto [i,j]:pos[l])
{
int x= (str[i][l]-'A'+1)*27+(str[i][l+1]-'A'+1);
int y= (str[j][l]-'A'+1)*27+(str[j][l+1]-'A'+1);
if(x>y) swap(x,y);
int cc= x*27*27+y;
if(num[cc]==0) ans++;
if(num[cc]==1) ans--;
num[cc]++;
}
}
cout<<ans<<endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 6124kb
input:
5 CELL GULL GUSH HALL HASH
output:
2
result:
ok single line: '2'
Test #2:
score: 0
Accepted
time: 8ms
memory: 6076kb
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: 3ms
memory: 6112kb
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: 6172kb
input:
4 ABCD AEFD AGHD AIJD
output:
6
result:
ok single line: '6'
Test #5:
score: 0
Accepted
time: 0ms
memory: 6132kb
input:
3 ABABA AABBA ABBAA
output:
2
result:
ok single line: '2'
Test #6:
score: 0
Accepted
time: 0ms
memory: 6180kb
input:
3 AAAAA ABBAA AABBA
output:
2
result:
ok single line: '2'
Test #7:
score: 0
Accepted
time: 0ms
memory: 6140kb
input:
8 ABBA ACCA AABB AACC DBBD DCCD EEBB EECC
output:
0
result:
ok single line: '0'
Test #8:
score: 0
Accepted
time: 3ms
memory: 6184kb
input:
6 ABBA ACCA AABB AACC DBBD DCCD
output:
1
result:
ok single line: '1'
Test #9:
score: 0
Accepted
time: 3ms
memory: 6172kb
input:
4 ABBA ACCA AABB AACC
output:
2
result:
ok single line: '2'
Test #10:
score: -100
Wrong Answer
time: 3ms
memory: 6060kb
input:
4 ABBA ACCA ABBAA ACCAA
output:
0
result:
wrong answer 1st lines differ - expected: '2', found: '0'