QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#260434 | #7700. Split Decisions | ItsJerr# | WA | 4ms | 4024kb | C++20 | 1.0kb | 2023-11-22 09:48:32 | 2023-11-22 09:48:33 |
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;
int Y=0;
for(int j=0;j<=m;++j) if(s[r][j]!=s[i][j]) ++Y;
if(Y!=2) continue;
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: 0ms
memory: 3688kb
input:
5 CELL GULL GUSH HALL HASH
output:
2
result:
ok single line: '2'
Test #2:
score: -100
Wrong Answer
time: 4ms
memory: 4024kb
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'