Source Code
#include <bits/stdc++.h>
#define quick ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define pii pair <int,int>
#define pll pair <ll,ll>
#define INF 1000000000
#define mod 1000000007
#define size(a) ((int)(a.size()))
using namespace std;

void solv()
{
	int n,k,m;
	cin>>n>>k>>m;
	int nb1=0,nb0=0;
	for(int i=0,x,y;i<n;i++)
    {
        cin>>x>>y;
        if(x%2==y%2)
        {
            if(x%2) nb1++;
            else nb0++;
        }
        else
        {
            if(k%1) {swap(x,y);k=0;}
            if(x%2) nb1++;
            else nb0++;
        }
    }
    if((m==0 && nb1%2==0) || (m==1 && nb1%2)) cout<<1<<endl;
    else cout<<2<<endl;

}
int main()
{
	quick
	//freopen(".in", "r", stdin);
	int T=1; //   cin>>T;
	while(T--)  solv();

	return 0;
}
Copy
Cliffs of Dover aboulkacem
GNU G++17
102 ms
716 KB
Wrong Answer