QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#670834 | #7700. Split Decisions | chengA | WA | 104ms | 3836kb | C++17 | 1.7kb | 2024-10-24 04:11:54 | 2024-10-24 04:11:54 |
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(n);
for (ll i = 0; i < n; i++) cin >> a[i];
auto itr = unique(a.begin(),a.end());
a.resize(distance(a.begin(), itr));
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;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3480kb
input:
5 CELL GULL GUSH HALL HASH
output:
2
result:
ok single line: '2'
Test #2:
score: -100
Wrong Answer
time: 104ms
memory: 3836kb
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'