求助刚才ABC的C。。WA了4个点
  • 板块学术版
  • 楼主BlackPanda
  • 当前回复7
  • 已保存回复7
  • 发布时间2022/11/26 21:46
  • 上次更新2023/10/27 01:19:29
查看原帖
求助刚才ABC的C。。WA了4个点
486799
BlackPanda楼主2022/11/26 21:46
#include <bits/stdc++.h>
using namespace std;

#define ll long long

int h, w;
string a[400005], b[400005];
string t1[400005], t2[400005];
map<string, ll> mp;
map<string, ll>::iterator it;

int main()
{  
    scanf("%d%d", &h, &w);
    for (int i = 0; i < h; i ++ )  cin >> a[i];
    for (int i = 0; i < h; i ++ )  cin >> b[i];

    for (int i = 0; i < w; i ++ )
    {
        for (int j = 0; j < h; j ++ )
            t1[i] += a[j][i];
        mp[t1[i]] += 1;
    }

    for (int i = 0; i < w; i ++ )
    {
        for (int j = 0; j < h; j ++ )
            t2[i] += b[j][i];
        mp[t2[i]] += 1;
    }
    // for (int i = 0; i < w; i ++ )
    // {
    //     cout << mp[t1[i]] << " " << mp[t2[i]] << endl;
    //     if (mp[t1[i]] % 2 != 0 || mp[t2[i]] % 2 != 0) 
    //     {
    //         cout << "No";
    //         return 0;
    //     }
    // }
    for(it=mp.begin();it!=mp.end();it++)
    {
        //cout << it->first << " " << it->second << endl;
        if (it->second % 2 == 1)
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}
2022/11/26 21:46
加载中...