QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#610123#7700. Split DecisionsMCdycCompile Error//C++231.4kb2024-10-04 14:58:592024-10-04 14:58:59

Judging History

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

  • [2024-10-04 14:58:59]
  • 评测
  • [2024-10-04 14:58:59]
  • 提交

answer

#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
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())
            {
                vector<int>pos;

                for (int k = 0; k < a[i].size(); k++)
                {
                    if(a[i][k]!=a[j][k])
                        pos.push_pack(k);
                }
                if (pos.size()==2&&pos[1]==pos[0]+1)
                {
                    string s, t;
                    s.push_back(a[i][pos[0]]), s.push_back(a[i][pos[1]]);
                    t.push_back(a[j][pos[0]]), t.push_back(a[j][pos[1]]);
                    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

answer.code: In function ‘void solve()’:
answer.code:25:29: error: ‘class std::vector<int>’ has no member named ‘push_pack’; did you mean ‘push_back’?
   25 |                         pos.push_pack(k);
      |                             ^~~~~~~~~
      |                             push_back