QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#484629 | #7700. Split Decisions | lwenj | WA | 43ms | 6052kb | C++14 | 965b | 2024-07-19 20:41:05 | 2024-07-19 20:41:06 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
vector<string> alls(1e5 + 10);
map<string, int> mp;
int main()
{
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> alls[i];
}
for (int i = 1; i <= n; i++) {
for (int j = i + 1; j <= n; j++) {
if ((int)alls[i].size() == (int)alls[j].size()) {
vector<int> tmp;
for (int k = 0; k < (int)alls[i].size(); k++) {
if (alls[i][k] != alls[j][k]) {
tmp.push_back(k);
}
}
if ((int)tmp.size() == 2 && tmp[0] + 1 == tmp[1]) {
string t1 = alls[i].substr(tmp[0], tmp[1] + 1), t2 = alls[j].substr(tmp[0], tmp[1] + 1);
if (t1 > t2)
swap(t1, t2);
string t = t1 + t2 + to_string(alls[i].size()) + to_string(tmp[0]) + to_string(tmp[1]);
mp[t]++;
}
}
}
}
int ans = 0;
for (auto [x, y] : mp) {
if (y == 1)
ans ++;
}
cout << ans << endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 6052kb
input:
5 CELL GULL GUSH HALL HASH
output:
2
result:
ok single line: '2'
Test #2:
score: -100
Wrong Answer
time: 43ms
memory: 5984kb
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:
680
result:
wrong answer 1st lines differ - expected: '621', found: '680'