QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#593263 | #7700. Split Decisions | feng | WA | 5ms | 3868kb | C++20 | 1.1kb | 2024-09-27 12:59:44 | 2024-09-27 12:59:45 |
Judging History
answer
#include<bits/stdc++.h>
//#define int long long
#define ll long long
#define endl '\n'
#define PII pair<int,int>
using namespace std;
const int maxn = 1e5;
vector<vector<string> > t(25, vector<string>());
int main() {
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
//cout << fixed << setprecision(2);
int n; cin >> n;
for (int i = 0; i < n; ++i) {
string s; cin >> s;
t[s.size()].push_back(s);
}
int ans = 0;
for (int i = 3; i <= 20; ++i) {
map<pair<string,int>, int> m;
for (int j = 0; j < t[i].size(); ++j) {
for (int k = j + 1; k < t[i].size(); ++k) {
int p1 = -1, p2 = -1;
bool flag = false;
for (int pos = 0; pos < i; ++pos) {
if (t[i][j][pos] != t[i][k][pos]) {
if (p1 == -1) p1 = pos;
else if (p2 == -1) p2 = pos;
else {
flag = true;
break;
}
}
}
if (flag) continue;
else {
m[{t[i][j].substr(p1, 2) + t[i][k].substr(p1, 2), p1}]++;
m[{t[i][k].substr(p1, 2) + t[i][j].substr(p1, 2), p1}]++;
}
}
}
for (auto p : m) {
if (p.second == 1) {
ans++;
}
}
}
cout << ans / 2 << endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3500kb
input:
5 CELL GULL GUSH HALL HASH
output:
2
result:
ok single line: '2'
Test #2:
score: -100
Wrong Answer
time: 5ms
memory: 3868kb
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:
930
result:
wrong answer 1st lines differ - expected: '621', found: '930'