1 条题解

  • 0
    @ 2025-8-13 15:04:41

    原题链接:

    题解:

    附赠一个自测的小工具:

    #include <iostream>
    #include <algorithm>
    
    using namespace std;
    int c, p[1005];
    int main()
    {
    	int n,x,y,p1,p2; 
        cin>>n>>x>>y>>p1>>p2;
        cout << n << " " << x << " " << y << endl;
        int cnt = 0;
        bool flag = true;
        while (1)
        {
        	char op;
        	cin>>op;
            if (op == '!')
            {
            	int pp1,pp2; 
                cin>>pp1>>pp2; 
    			if (pp1 == p1 && pp2 == p2)
                    cout<<"Good"<<endl;
                else
                	cout<<"WA"<<endl;
            }
            if (op == '?')
            {
                cnt++;
                if (cnt > 19)
                    cout<<"Too Many '?'"<<endl;
                cin>>c;
                for (int i = 1; i <= c; i++)
                    cin>>p[i];
                sort(p + 1, p + c + 1);
                int res = 0;
                for (int i = 1; i <= c; i++)
                {
                    if (p[i] == p1 || p[i] == p2)
                        res = res ^ y;
                    else
                        res = res ^ x;
                    if (i > 1 && p[i] == p[i - 1])
                        cout<<"Same P[i]"<<endl;
                }
                cout << res << endl;
            }
        }
    }
    
    • 1

    信息

    ID
    44
    时间
    1000ms
    内存
    256MiB
    难度
    10
    标签
    递交数
    19
    已通过
    1
    上传者