QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#610140 | #7700. Split Decisions | MCdyc | WA | 37ms | 3700kb | C++23 | 1.4kb | 2024-10-04 15:01:29 | 2024-10-04 15:01:31 |
Judging History
answer
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
void solve()
{
int n;
cin >> n;
vector<string> a(n);
for (int i = 0; i < n; i++)
{
cin >> a[i];
}
map<string, int> ans;
sort(a.begin(),a.end());
a.erase(unique(a.begin(),a.end()),a.end());
for (int i = 0; i < n; i++)
{
for (int j = i + 1; j < n; j++)
{
if (a[i].size() == a[j].size())
{
vector<int>pos;
for (int k = 0; k < a[i].size(); k++)
{
if(a[i][k]!=a[j][k])
pos.push_back(k);
}
if (pos.size()==2&&pos[1]==pos[0]+1)
{
string s, t;
s.push_back(a[i][pos[0]]), s.push_back(a[i][pos[1]]);
t.push_back(a[j][pos[0]]), t.push_back(a[j][pos[1]]);
if (s > t)
{
swap(s, t);
}
s += t;
ans[s]++;
}
}
}
}
int cnt = 0;
for (auto it : ans)
{
if (it.second == 1)
{
cnt++;
}
}
cout << cnt;
return;
}
signed main()
{
cin.tie(nullptr)->sync_with_stdio(NULL);
int t = 1;
// cin >> t;
while (t--)
solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3700kb
input:
5 CELL GULL GUSH HALL HASH
output:
2
result:
ok single line: '2'
Test #2:
score: -100
Wrong Answer
time: 37ms
memory: 3664kb
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:
585
result:
wrong answer 1st lines differ - expected: '621', found: '585'