QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#610373 | #7700. Split Decisions | xyyy | WA | 9ms | 4080kb | C++17 | 1.0kb | 2024-10-04 15:45:17 | 2024-10-04 15:45:18 |
Judging History
answer
#include<iostream>
#include<vector>
#include<algorithm>
#include<vector>
#include<string>
#include<cstring>
#include<queue>
#include<map>
using namespace std;
#define int long long
#define endl "\n"
map<pair<string,string>,int>idx;
void solve(){
int n;
cin>>n;
vector<string>arr(n+1);
for(int i=1;i<=n;i++){
cin>>arr[i];
}
for(int i=1;i<=n;i++){
for(int j=i+1;j<=n;j++){
// if(arr[i].size()!=arr[j].size())continue;
{
int cnt1=0;
int pos=-1;
for(int k=0;k<(int)arr[i].size()-1;k++){
if((arr[i][k]!=arr[j][k])&&(arr[i][k+1]!=arr[j][k+1])){
cnt1++;
pos=k;
}
}
if(cnt1!=1)continue;
pair<string,string>t;
t.first=arr[i].substr(pos,2);
t.second=arr[j].substr(pos,2);
if(t.first>t.second)swap(t.first,t.second);
idx[{t.first,t.second}]++;
}
}
}
int ans=0;
for(auto t:idx){
if(t.second==1)ans++;
}
cout<<ans<<endl;
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
solve();
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3776kb
input:
5 CELL GULL GUSH HALL HASH
output:
2
result:
ok single line: '2'
Test #2:
score: -100
Wrong Answer
time: 9ms
memory: 4080kb
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'