Source Code
/*
	Failure is not the reason for you to stop trying
	   it is actually a remainder that you should
			KEEP GOING
*/
#include<bits/stdc++.h>
#define ll long long
#define SaveTime ios_base::sync_with_stdio(false), cin.tie(0);
using namespace std;

int main()
{
   SaveTime
   int n, k, p; cin >> n >> k >> p;
   int oddv = 0, evenv = 0;
   for (int i = 1; i <= n; i++) {
      int v,h; cin >> v >> h;
      if (i%2) {
         oddv+= v+h;
      }
      else {
         evenv+= v+h;
      }
   }
   ///cout << oddv << endl;
   if (p == 1) {
      if (k%2 == 0 && oddv %2 == 0) {
         cout << 2;
      }
      else if (k%2 == 0 && oddv%2 == 1) {
         cout << 1;
      }
      if (k%2 == 1&& oddv %2 == 0) {
         cout << 1;
      }
      else if (k%2 == 1 && oddv%2 == 1) {
         cout << 2;
      }
   }
   else {
      if (k%2 == 0 && oddv %2 == 0) {
         cout << 1;
      }
      else if (k%2 == 0 && oddv%2 == 1) {
         cout << 2;
      }
      if (k%2 == 1&& oddv %2 == 0) {
         cout << 2;
      }
      else if (k%2 == 1 && oddv%2 == 1) {
         cout << 1;
      }
   }
}
Copy
Cliffs of Dover chaffar107
GNU G++17
70 ms
704 KB
Wrong Answer