QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#260433 | #7700. Split Decisions | ItsJerr# | WA | 23ms | 4164kb | C++20 | 957b | 2023-11-22 09:44:54 | 2023-11-22 09:44:54 |
Judging History
answer
/*input
5
CELL
GULL
GUSH
HALL
HASH
*/
#include <bits/stdc++.h>
using namespace std;
const int N = 2000;
string s[N];
int main() {
cin.tie(0)->sync_with_stdio(0);
int n;
cin >> n;
for (int i = 1; i <= n; ++i)
cin >> s[i];
map<string, int> Map;
for (int i = 1; i < n; ++i)
{
for (int r = i + 1; r <= n; ++r)
{
if (s[i].size() != s[r].size()) continue;
int m = s[i].size() - 1;
string Dif = "", _Dif = "";
int D = 0;
for (int j = 0; j < m; ++j)
{
if (s[i][j] != s[r][j] && s[i][j + 1] != s[r][j + 1])
{
++D;
if (D == 1)
{
Dif = s[i].substr(j, 2) + s[r].substr(j, 2);
_Dif = s[r].substr(j, 2) + s[i].substr(j, 2);
// cout << Dif << '\n';
}
else
break;
}
}
if (D == 1)
{
++Map[Dif];
++Map[_Dif];
}
}
}
int ans = 0;
for (auto h : Map) if (h.second == 1) ++ans;
cout << ans/2;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3436kb
input:
5 CELL GULL GUSH HALL HASH
output:
2
result:
ok single line: '2'
Test #2:
score: -100
Wrong Answer
time: 23ms
memory: 4164kb
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'