QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#670818 | #7700. Split Decisions | chengA | WA | 122ms | 3856kb | C++17 | 1.4kb | 2024-10-24 03:32:34 | 2024-10-24 03:32:35 |
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(){
ll n; cin >> n;
vector<string> a(n);
for (ll i = 0; i < n; i++) cin >> a[i];
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){
if (s2a.compare(s2b) > 0) m[s2a+s2b]++;
else m[s2b+s2a]++;
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: 3576kb
input:
5 CELL GULL GUSH HALL HASH
output:
2
result:
ok single line: '2'
Test #2:
score: -100
Wrong Answer
time: 122ms
memory: 3856kb
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:
705
result:
wrong answer 1st lines differ - expected: '621', found: '705'