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, oddh = 0, evenv = 0, evenh = 0;
   for (int i = 1; i <= n; i++) {
      int v,h; cin >> v >> h;
      if (i%2) {
         oddv+= v;
         oddh+= h;
      }
      else {
         evenv+= v;
         evenh+= h;
      }
   }
   if (p == 0) {
      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
42 ms
708 KB
Wrong Answer