QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#592933 | #7700. Split Decisions | feng | WA | 71ms | 3852kb | C++20 | 1.1kb | 2024-09-27 10:10:42 | 2024-09-27 10:10:44 |
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>());
signed 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<string, int> m;
for (int j = 0; j < t[i].size(); ++j) {
for (int k = j + 1; k < t[i].size(); ++k) {
for (int pos = 0; pos < i-1; ++pos) {
string s1 = t[i][j];
string s2 = t[i][k];
if (s1.substr(0, pos) == s2.substr(0, pos) && s1.substr(pos + 2, i - pos - 2) == s2.substr(pos + 2, i - pos - 2)) {
m[{s1.substr(pos, 2) + s2.substr(pos, 2)}]++;
m[{s2.substr(pos, 2) + s1.substr(pos, 2)}]++;
}
}
}
}
for (auto p : m) {
string s = p.first;
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: 3852kb
input:
5 CELL GULL GUSH HALL HASH
output:
2
result:
ok single line: '2'
Test #2:
score: -100
Wrong Answer
time: 71ms
memory: 3800kb
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:
809
result:
wrong answer 1st lines differ - expected: '621', found: '809'