QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#610018#7700. Split DecisionsMCdycWA 8ms3928kbC++201.5kb2024-10-04 14:43:102024-10-04 14:43:16

Judging History

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

  • [2024-10-04 14:43:16]
  • 评测
  • 测评结果:WA
  • 用时:8ms
  • 内存:3928kb
  • [2024-10-04 14:43:10]
  • 提交

answer

#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
const double inf = 1e18;
void solve()
{
    int n;
    cin >> n;
    vector<string> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    map<string, int> ans;
    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            if (a[i].size() == a[j].size())
            {
                int pos = 1;
                int cnt = 0;
                for (int k = 1; k < a[i].size(); k++)
                {
                    if (a[i][k] != a[j][k] && a[i][k - 1] != a[j][k - 1])
                    {
                        cnt++;
                        pos = k;
                    }
                }
                if (cnt == 1)
                {
                    string s, t;
                    s.push_back(a[i][pos - 1]), s.push_back(a[i][pos]);
                    t.push_back(a[j][pos - 1]), t.push_back(a[j][pos]);
                    if (s > t)
                    {
                        swap(s, t);
                    }
                    s += t;
                    ans[s]++;
                }
            }
        }
    }
    int cnt = 0;
    for (auto it : ans)
    {
        if (it.second == 1)
        {
            cnt++;
        }
    }
    cout << cnt;
    return;
}

signed main()
{
    cin.tie(nullptr)->sync_with_stdio(NULL);

    int t = 1;
    // cin >> t;
    while (t--)
        solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3612kb

input:

5
CELL
GULL
GUSH
HALL
HASH

output:

2

result:

ok single line: '2'

Test #2:

score: -100
Wrong Answer
time: 8ms
memory: 3928kb

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:

2656

result:

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