红了求助
查看原帖
红了求助
977778
__Harry_Haiyun__楼主2023/8/9 21:18
#include <bits/stdc++.h>
#define MOD 998244353
#define mod 1000000007
#define ll long long
#define ull unsigned long long
#define ui unsigned int
using namespace std;
const int maxn = 1e6+9;
int main()
{
	int n,m,x;
	cin >> n >> m;
	bool a[n];
	memset(a,false,sizeof(a));
	while (m--)
	{
	    cin >> x;
	    if (x == 1)
	    {
	        a[0] = !a[0];
	        a[1] = !a[1];
	        a[n - 1] = !a[n - 1];
        }
        else
        {
            a[x] = !a[x];
            a[x - 1] = !a[x - 1];
            a[x + 1] = !a[x + 1]; 
        }
    }
    for (int i = 0; i < n; i++)
        cout << a[i] << " ";
	return 0;
}
2023/8/9 21:18
加载中...