Source Code
#include<bits/stdc++.h>

#define int long long
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(),x.end()

const double eps=1e-7,PI=3.1415926;
const int N=1e6+10;

using namespace std;

int n,q,m,k,x,y,a[N],mx=-1,mn=1e9,sum,cnt,z;
string s,s1,s2;
map < int , int > mp;
vector < int > vec;

int32_t main(){
    cin>>n>>k>>m;
    for (int i=0;i<n;i++){
        cin>>x>>y;
        sum+=(x%2);
        if (x%2==y%2)continue;
        cnt++;
    }
    if (cnt==0){
        if (sum%2==m)return cout<<1<<endl,0;
        return cout<<2<<endl,0;
    }
    if (k%2)cout<<1<<endl;
    else cout<<2<<endl;
    return 0;
}
Copy
Cliffs of Dover BabaVoss
GNU G++17
407 ms
896 KB
Accepted