QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#359516#7700. Split Decisionswarner1129#WA 41ms3588kbC++202.1kb2024-03-20 18:44:582024-03-20 18:44:58

Judging History

你现在查看的是最新测评结果

  • [2024-03-20 18:44:58]
  • 评测
  • 测评结果:WA
  • 用时:41ms
  • 内存:3588kb
  • [2024-03-20 18:44:58]
  • 提交

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);
                    cnt[{a + b, S[i].size()}]++;
                }
            }
        for (auto &[a, b] : cnt)
            if (b == 1) {
                ans++;
            }
    }

    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: 1ms
memory: 3584kb

input:

5
CELL
GULL
GUSH
HALL
HASH

output:

2

result:

ok single line: '2'

Test #2:

score: -100
Wrong Answer
time: 41ms
memory: 3588kb

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:

1023

result:

wrong answer 1st lines differ - expected: '621', found: '1023'