QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#670835 | #7700. Split Decisions | chengA | WA | 109ms | 3768kb | C++17 | 1.7kb | 2024-10-24 04:22:20 | 2024-10-24 04:22:20 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define FILEIO 0
#define ll long long
#define endl "\n"
#define IN cin
#define OUT cout
#define FOR(var, start, end) for (int var = start; var < end; var++)
#define MAXSIZE (int)(2*10e5)
#define dbg(v) cout << "Line(" << __LINE__ << ") -> " << #v << " = " << (v) << endl;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll n; cin >> n;
vector<string> a;
set<string> s;
for (ll i = 0; i < n; i++){
string x; cin >> x;
s.insert(x);
}
for (auto i : s) a.push_back(i);
n = a.size();
map<string, ll> m;
for (int i = 0; i < n-1 ; i++){
for (int j = i+1; j <n ; j++){
if (a[i].size() != a[j].size()) continue;
for (int x = 0 ; x < a[i].size()-1 ; x++){
string s1a = a[i].substr(0,x);
string s1b = a[j].substr(0,x);
string s2a = a[i].substr(x,2);
string s2b = a[j].substr(x,2);
string s3a = a[i].substr(x+2, a[i].size()-x-2);
string s3b = a[j].substr(x+2, a[i].size()-x-2);
if (s1a.compare(s1b) ==0 && s2a.compare(s2b) != 0 && s3a.compare(s3b) == 0){
s1a.replace(0,s1a.size(),s1a.size(),'_');
s3a.replace(0,s3a.size(),s3a.size(),'_');
if (s2a.compare(s2b) > 0) m[s1a+s2a+s2b + s3a]++;
else m[s1a+ s2b+s2a + s3a]++;
break;
}
}
}
}
ll count = 0;
for (auto i : m){
if (i.second == 1){
count++;
}
}
cout << count;
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3768kb
input:
5 CELL GULL GUSH HALL HASH
output:
2
result:
ok single line: '2'
Test #2:
score: -100
Wrong Answer
time: 109ms
memory: 3768kb
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:
777
result:
wrong answer 1st lines differ - expected: '621', found: '777'