QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#360125 | #7700. Split Decisions | warner1129 | WA | 3ms | 3652kb | C++20 | 2.2kb | 2024-03-21 13:07:35 | 2024-03-21 13:07:36 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
template <ranges::range T,
class = enable_if_t<!is_convertible_v<T, string_view>>>
istream &operator>>(istream &s, T &&v) {
for (auto &&x : v)
s >> x;
return s;
}
template <ranges::range T,
class = enable_if_t<!is_convertible_v<T, string_view>>>
ostream &operator<<(ostream &s, T &&v) {
for (auto &&x : v)
s << x << ' ';
return s;
}
#ifdef LOCAL
template <class... T> void dbg(T... x) {
char e{};
((cerr << e << x, e = ' '), ...);
}
#define debug(x...) dbg(#x, '=', x, '\n')
#else
#define debug(...) ((void)0)
#endif
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define ff first
#define ss second
template <class T> inline constexpr T inf = numeric_limits<T>::max() / 2;
template <class T> bool chmin(T &a, T b) { return (b < a and (a = b, true)); }
template <class T> bool chmax(T &a, T b) { return (a < b and (a = b, true)); }
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
using i128 = __int128;
// constexpr i64 mod = 1e9 + 7;
void solve() {
int n;
cin >> n;
vector<string> S(n);
cin >> S;
int ans = 0;
for (int k = 0; k + 1 < 20; k++) {
map<pair<string, int>, int> cnt;
for (int i = 0; i < n; i++)
for (int j = i + 1; j < n; j++) {
if (S[i].size() != S[j].size() or k + 1 >= S[i].size())
continue;
if (S[i].substr(0, k) == S[j].substr(0, k) and S[i].substr(k + 2) == S[j].substr(k + 2)) {
string a = S[i].substr(k, 2);
string b = S[j].substr(k, 2);
if (a[0] != b[0] and a[1] != b[1]) {
cnt[{a + b, S[i].size()}]++;
}
}
}
for (auto &[a, b] : cnt)
if (b == 1) {
ans++;
}
break;
}
cout << ans << '\n';
}
signed main() {
cin.tie(0)->sync_with_stdio(false);
cin.exceptions(cin.failbit);
int t = 1;
// cin >> t;
while (t--) {
solve();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3576kb
input:
5 CELL GULL GUSH HALL HASH
output:
2
result:
ok single line: '2'
Test #2:
score: -100
Wrong Answer
time: 3ms
memory: 3652kb
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:
0
result:
wrong answer 1st lines differ - expected: '621', found: '0'