月赛T2求调(悬赏2关)
  • 板块灌水区
  • 楼主fish_gugu
  • 当前回复5
  • 已保存回复5
  • 发布时间2023/4/22 20:36
  • 上次更新2023/10/23 17:45:39
查看原帖
月赛T2求调(悬赏2关)
759436
fish_gugu楼主2023/4/22 20:36
#include <bits/stdc++.h>
using namespace std;
unsigned int y[100005],x[100005];
int main()
{
    int t;
    cin >> t;
    for(int a = 1;a <= t;a++)
    {
        int n,k,temp = 0;
        cin >> n >> k;
        for(int b = 1;b <= n;b++) cin >> y[b];
        for(int b = 1;b <= k;b++)
        {
            for(int c = 1;c <= n;c++)
            {
            	temp = 0;
                for(int d = 1;d <= n;d++)
                {
                	if(d == c) continue;
                    temp = temp ^ y[d];
                }
                x[c] = temp;
                temp = 0;
            }
			for(int b = 1;b <= n;b++) y[b] = x[b];
        }
        for(int b = 1;b <= n;b++) cout << x[b] << " ";
        
    }
    return 0;
}

思路应该是对的,摆出来的样例也过了,然而大部分TLE(QWQ)

2023/4/22 20:36
加载中...