比赛 EYOI与SBOI开学欢乐赛3rd 评测结果 TTTTTTTTTT
题目名称 异或加密 最终得分 0
用户昵称 惠惠 运行时间 10.000 s
代码语言 C++ 内存使用 13.37 MiB
提交时间 2022-09-05 21:12:14
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;

int n, ming[1000010], mi[1000010], ans = 1;


int main()
{
    freopen("XORcipher.in", "r", stdin);
    freopen("XORcipher.out", "w", stdout);
    cin >> n;
    for(int i = 1; i <= n; ++i)
    {
        cin >> ming[i];
    }
    for(int i = 1; i <= n; ++i)
    {
        cin >> mi[i];
    }
    for(int i = 1; i <= n;)
    {
        bool found = false;
        for(int j = 1; j <= n; ++j)
        {
            int x = ming[i] ^ ans;
            if(mi[j] == x)
            {
                // cout << "ming:" << ming[i] << " mi:" << mi[j] << " ans:" << ans << " ^:" << x << endl;
                found = true;
                break;
            }
        }
        if(!found)
        {
            ++ans;
            i = 1;
        }
        else ++i;
    }
    cout << ans << endl;
    return 0;
}