prompt
string
response
string
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int n; int a, b, c, d; int main() { scanf("%d", &n); printf("YES\n"); for (int i = 1; i <= n; i++) { scanf("%d%d%d%d", &a, &b, &c, &d); printf("%d\n", ((2 * (a % 2) + (b % 2)) % 4 + 4) % 4 + 1); } return 0; }
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> #pragma GCC optimize("O3") using namespace std; int main() { int n; scanf("%d", &n); puts("YES"); for (int i = 0; i < n; i++) { int x1, y1, x2, y2; scanf("%d %d %d %d", &x1, &y1, &x2, &y2); if (x1 & 1 && y1 & 1) { puts("1"); } else if (x1 & 1 && !(y1 & 1)) { ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; const long long maxn = 200010; long long n, a, b, c, d; long long dz = 1e9; long long cd[2][2] = {{1, 2}, {3, 4}}; signed main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> n; cout << "YES" << endl; for (long long i = 0; i < (long long)(n); i++) { ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; scanf("%d", &n); puts("YES"); for (int i = 0; i < n; i++) { int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d); printf("%d\n", ((12 + 2 * (a % 2) + (b % 2)) % 4) + 1); } return 0; }
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.StringTokenizer; import java.util.ArrayList; public class D { static class Scanner{ BufferedReader br=null; StringTokenizer tk=null; public Scanner(){ br=new BufferedRead...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf("%d", &n); printf("YES\n"); int a, b, c, d; for (int i = 0; i < n; i++) { scanf("%d%d%d%d", &a, &b, &c, &d); if (a < 0) a *= -1; if (b < 0) b *= -1; if (c < 0) c *= -1; if (d < 0) d *= -1; if ((a & 1) && (b & 1)) ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
n = int(input()) print("YES") for i in range(n): x1, y1, x2, y2 = map(int, input().split()) print((x1 % 2) * 2 + (y1 % 2) + 1)
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf("%d", &n); printf("YES\n"); for (int i = 1; i <= n; i++) { int x1, y1, x2, y2; scanf("%d%d%d%d", &x1, &y1, &x2, &y2); if (x1 % 2 == 0) { if (y1 % 2 == 0) printf("1\n"); else printf("2\n"); } else ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; cout << "YES\n"; for (int i = 1; i <= n; i++) { int x1, x2, y1, y2; cin >> x1 >> y1 >> x2 >> y2; cout << (2 * ((x1 % 2 + 2) % 2) + (y1 % 2 + 2) % 2) + 1 << "\n"; } }
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @auth...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
n = int(input()) print("YES") for i in range(n): t1, y1, x2, y2 = input().split() print((int(t1) % 2) * 2 + (int(y1) % 2) + 1)
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int x[500500]; int y[500500]; int main() { int n; while (~scanf("%d", &n)) { for (int i = 1; i <= n; i++) { int tmp1, tmp2; scanf("%d%d%d%d", &x[i], &y[i], &tmp1, &tmp2); } puts("YES"); for (int i = 1; i <= n; i++) { if (x[i] < 0) x[i] ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; const int dx44[5] = {0, -1, -1, 1, 1}; const int dy44[5] = {0, -1, 1, -1, 1}; const int dx4[5] = {0, -1, 0, 1, 0}; const int dy4[5] = {0, 0, 1, 0, -1}; const int dx8[9] = {0, -1, 0, 1, 0, 1, 1, -1, -1}; const int dy8[9] = {0, 0, 1, 0, -1, 1, -1, 1, -1}; const int maxn = 5e5...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; template <typename T> bool maxup(T& a, const T&& b) { if (a < b) { a = b; return true; }; } template <typename T> bool maxup(T& a, const T& b) { if (a < b) { a = b; return true; }; } template <typename T> bool minup(T& a, const T&& b) { if (a > b) ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int x[500500]; int y[500500]; int main() { int n; while (~scanf("%d", &n)) { for (int i = 1; i <= n; i++) { int tmp1, tmp2; scanf("%d%d%d%d", &x[i], &y[i], &tmp1, &tmp2); } printf("YES\n"); for (int i = 1; i <= n; i++) { if (x[i] < 0) x...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); int n; cin >> n; cout << "YES\n"; for (int i = 0; i < n; ++i) { int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; cout << (x1 & 1) + ((y1 & 1) << 1) + 1 << endl; } return 0; }
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
'''plan noticed that if both upperle ''' from sys import stdin, stdout n = int(stdin.readline().rstrip()) # n = int(input()) coordinates = [] # for i in range(n): # coordinates.append([int(x) % 2 for x in input().split()]) for i in range(n): coordinates.append([int(x) % 2 for x in stdin.readline().rstrip()....
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 5e3; const int INF = 1e9; int main() { int n; cin >> n; cout << "YES\n"; for (int i = 0; i < n; i++) { int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; x1 += INF; y1 += INF; int r = (x1 % 2) * 2 + (y1 % 2) + 1; cout << r << e...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
import java.io.*; import java.util.*; /** * * @author Sourav Kumar Paul (spaul100) * NIT Silchar */ public class SolveD { public static Reader in; public static PrintWriter out; public static long mod = 1000000007; public static long inf = 100000000000000000l; public static long fac[],inv...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> int n; int main() { scanf("%d", &n); puts("YES"); for (int i = 0, x, y, _, __; i < n; ++i) { scanf("%d%d%d%d", &x, &y, &_, &__); printf("%d\n", (((x & 1) << 1) | (y & 1)) + 1); } return 0; }
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; const int maxn = 5e5 + 5; int n, x[maxn], y[maxn], xx[maxn], yy[maxn]; int ans[maxn]; int main() { while (scanf("%d", &n) != EOF) { for (int i = 1; i <= n; i++) { scanf("%d %d %d %d", &x[i], &y[i], &xx[i], &yy[i]); x[i] = min(x[i], xx[i]); y[i] = max...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int main() { std::ios::sync_with_stdio(false); cin.tie(0); long long n, a, b, c, d; cout << "YES\n"; cin >> n; while (n--) { cin >> a >> b >> c >> d; cout << abs(c % 2) + 1 + 2 * abs(d % 2) << "\n"; } }
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
from sys import stdin,stdout n = int(stdin.readline()) stdout.write("YES") stdout.write('\n') for i in range(n): x1, y1, x2, y2 = map(int,stdin.readline().split()) stdout.write(str((x1 % 2) * 2 + (y1 % 2) + 1)) stdout.write('\n')
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
/** * Created by tagirov2 on 28.06.2017. */ import java.util.*; import java.io.*; public class Sample02_01 { public static void main (String [] param) { boolean oj = System.getProperty ("ONLINE_JUDGE") != null; Scanner in = new Scanner (System.in); PrintWriter out = new PrintWriter ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; inline void EnableFileIO(const string& fileName) { if (fileName.empty()) return; freopen((fileName + ".in").c_str(), "r", stdin); freopen((fileName + ".out").c_str(), "w", stdout); return; } const long long INF = 1e9; const double EPS = 1e-10; const int N = 5e5 + 10...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; inline int read() { char c = getchar(); int x = 0, f = 1; while (c < '0' || c > '9') { if (c == '-') f = -1; c = getchar(); } while (c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); } return x * f; } int n, x, y; int main(int argc, ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ //package Round_395_Div_2; import java.util.Scanner; /** * * @author DAFFODIL */ public class D { public static void main(Stri...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; /** * @author Don Li */ public class TimofeyRectangles { void solve() { int n = in.nextInt(); out.println("YES"); for (i...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
n = int(input()) a = [0 for i in range(n)] for i in range(n): inp = input().split() x = int(inp[0]) y = int(inp[1]) a[i] = 2 * (x % 2) + (y % 2) + 1 print("YES") print("\n".join(str(i) for i in a))
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, x1, y1, x2, y2; cin >> n; cout << "YES" << '\n'; for (int i = 1; i <= n; i++) { cin >> x1 >> y1 >> x2 >> y2; if ((x1 % 2 + 2) % 2 == 1) { if ((y1 % 2 + 2) % 2 == 1) cout <...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int n, a, b, c, d; int main() { scanf("%d", &n); printf("YES\n"); for (int i = 1; i <= n; i++) { scanf("%d%d%d%d", &a, &b, &c, &d); printf("%d\n", 1 + 2 * (abs(a) % 2) + abs(b) % 2); } }
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; const int Z = (int)1e5 + 111; const int INF = (int)1e9 + 111; int main() { int n, x1, x2, y1, y2; scanf("%d", &n); printf("YES\n"); while (n--) { scanf("%d%d%d%d", &x1, &y1, &x2, &y2); x1 = min(x1, x2); y1 = min(y1, y2); if (x1 % 2 && !(y1 % 2)) ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
import java.io.*; import java.util.LinkedList; import java.util.Objects; import java.util.StringTokenizer; import java.util.TreeSet; public final class Main { static char[] chars = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}; ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
print('YES') for _ in range(int(input())): a,b,c,d = map(int,input().split()) print((2*(a%2))+(b%2)+1)
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Collections; import java.util.LinkedList; import java.util.StringTokenizer; import java.util.TreeSet; public class D { public static void main(String[] args) throws Exception { FastScanner scan = new FastS...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int aa[2000600]; int haha[2000600]; int main() { int n; scanf("%d", &n); int x, y; cout << "YES" << endl; for (int i = 0; i < n; i++) { scanf("%d%d", &x, &y); scanf("%d%d", &x, &y); if (x % 2 == 0) { if (y % 2 == 0) cout << 1 << endl; ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int n; int main() { scanf("%d", &n); puts("YES"); for (int i = 0; i < n; ++i) { int a, b, c, d; scanf("%d %d %d %d", &a, &b, &c, &d); printf("%d\n", 2 * (a & 1) + (b & 1) + 1); } }
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int main() { long long n, x1, y1, x2, y2; cin >> n; cout << "YES\n"; for (long long i = 0; i < n; i++) { cin >> x1 >> y1 >> x2 >> y2; long long a = abs(x1 % 2), b = abs(y1 % 2); cout << a * 2 + b + 1 << "\n"; } }
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
n = int(input()) rectangles = [] for i in range(n): a, b, c, d = tuple(map(int,input().split())) rectangles.append((a,b)) print("YES") for i in range(n): a,b = rectangles[i][0], rectangles[i][1] if a%2 == 0 and b%2 == 0: print(1) elif a%2 == 0 and b%2 == 1: print(2) elif a%2 == ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int n, a, b, c, d; int main() { puts("YES"); scanf("%d", &n); while (n--) { scanf("%d%d%d%d", &a, &b, &c, &d); printf("%d\n", ((a & 1) << 1) + (b & 1) + 1); } }
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; template <class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; } template <class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; } int main() { int n; printf("YES\n"); scanf("%d", &n); for (int i = 0; i < n; i++) { int x1, y1, ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
n = input() print "YES" for _ in range(n): a,b,c,d = map(int, raw_input().split()) a = min(a, c) b = min(b, d) print 1+(a%2)*2+b%2
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int main() { int n, x1, y1, x2, y2; scanf("%d", &n); puts("YES"); while (n--) { scanf("%d%d%d%d", &x1, &y1, &x2, &y2); x1 = abs(x1); y1 = abs(y1); if (x1 % 2 == 1 && y1 % 2 == 1) puts("1"); else if (x1 % 2 == 0 && y1 % 2 == 1) puts("2...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int n, a, b, c, d; int main() { cin >> n, puts("YES"); for (int i = 1; i <= n; i++) { scanf("%d%d%d%d", &a, &b, &c, &d); printf("%d\n", 1 + (a & 1) + ((b & 1) << 1)); } }
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
n=input() print "YES" for i in range(n): x1,y1,x2,y2=map(int,raw_input().split(" ")) if x1%2==0 and y1%2==0: print 1 elif (x1%2==0 and y1%2!=0): print 2 elif (x1%2!=0 and y1%2!=0): print 3 else: print 4
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
'''plan noticed that if both upperle ''' from sys import stdin, stdout # n = int(stdin.readline().rstrip()) # n = int(input()) all_lines = stdin.read().split('\n') stdout.write('YES\n') for line in all_lines[1:-1]: x1, y1, x2, y2 = (int(x) % 2 for x in line.split()) num = 2 * x2 + y2 + 1 # stdout.write...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const double eps = 1e-8; const int mod = 1000000007; const double pi = acos(-1.0); inline void gn(long long& x) { int sg = 1; char c; while (((c = getchar()) < '0' || c > '9') && c != '-') ; c == '-' ? (sg = -1, x = 0) : (x = c - '0')...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
import java.io.*; import java.util.*; import java.math.*; public class utkarsh { InputStream is; PrintWriter out; void solve(){ //Enter code here out.println("YES"); int a,b,c,d; int n=ni(); for(int i=0; i<n; i++){ a=ni(); b=ni(); ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
n = int(input()) print("YES") for i in range(n): z1, y1, x2, y2 = input().split() print((int(z1) % 2) * 2 + (int(y1) % 2) + 1)
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1); const int N = 1e5 + 10; const int inf = 0x3f3f3f3f; const long long INF = 0x3f3f3f3f3f3f3f3fLL; int main() { int n, a, b, c, d; cin >> n; puts("YES"); while (n--) { cin >> a >> b >> c >> d; cout << 1 + 2 * (abs(a) % 2) + (abs(b) %...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y, z; cin >> n; cout << "YES\n"; while (n--) { cin >> x >> y >> z >> z; cout << ((x & 1) * 2 + (y & 1) + 1) << '\n'; } }
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; inline void ri(int &x) { x = 0; static char c; bool t = 0; while (c = getchar(), c < '0' || c > '9') if (c == '-') t = 1; else t = 0; do x = x * 10 + c - '0'; while (c = getchar(), c >= '0' && c <= '9'); if (t) x = -x; } int main() { int ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; using itn = int; const long double PI = 3.141592653589793238; long long pow(long long x, long long pw) { long long res = 1; for (; pw; pw >>= 1) { if (pw & 1) { res *= x; } x = x * x; } return res; } void NO() { cout << "NO"; exit(0); } long lo...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; cout << "YES" << endl; for (int i = 0; i < n; i++) { vector<pair<int, int> > po(4); cin >> po[0].first >> po[0].second; cin >> po[1].first >> po[1].second; po[2].first = po[0].first; po[2].second = po[1].second; ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; const int nn = (int)2000000; const long double eps = 3 * 10e-8; const long double eps1 = 5 * 10e-8; const unsigned long long INF = (unsigned long long)(1e19 * 1.7); const long long mod = 10; int main() { long long n; cout << "YES\n"; cin >> n; for (int i = 0; i < n;...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; const int N = 5e5 + 5; inline int read() { char c = getchar(); int x = 0, f = 1; while (c < '0' || c > '9') { if (c == '-') f = -1; c = getchar(); } while (c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); } return x * f; } int n, x,...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int i, j, n, m, a, b, c, d, op, maxi, mini, mij, ls, ld, ul, timp, k, cul[1000005]; string s, t; int f[1000005], k1, k2, k3; vector<int> v[1000005]; char ch; void go(int nod, int tata, int parinte) { f[nod] = parinte; if (cul[nod] != cul[tata] && tata != parinte) { ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int n; int col[500005]; struct Rec { int x0, y0, x1, y1, index; } r[500005]; inline void read(int &x) { x = 0; char c = getchar(); int f = 1; while (c < '0' || c > '9') { if (c == '-') f = -1; c = getchar(); } while (c >= '0' && c <= '9') { x = 10 ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; const int Inf = 0x7fffffff; const int maxn = 1e5 + 5; const double eps = 1e-10; int n; int main() { while (cin >> n) { int a, b, c, d; cout << "YES" << endl; for (int i = 0; i < n; i++) { cin >> a >> b >> c >> d; cout << 2 * (a & 1) + (b & 1) + 1 <...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; puts("YES"); while (n--) { int x, y; scanf("%d%d%*d%*d", &x, &y); cout << (((x & 1) << 1) + (y & 1) + 1) << endl; } return 0; }
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; template <class T> inline bool updateMin(T& a, T b) { return a > b ? a = b, 1 : 0; } template <class T> inline bool updateMax(T& a, T b) { return a < b ? a = b, 1 : 0; } inline int nextInt() { int x; scanf("%d", &x); return x; } inline long long nextI64() { long...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 5; const int INF = 1e9 + 7; const long double EPS = 1e-9; const long double PI = 3.14159265359; int main() { int n; cin >> n; cout << "YES\n"; for (int i = 0; i < n; i++) { int x1, x2, y1, y2; cin >> x1 >> y1 >> x2 >> y2; cout << (...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
# -*- coding: utf-8 -*- # from __future__ import division import sys n = int(sys.stdin.readline()) data = [[0] * 4 for i in range(n)] colors = [0] * n for i in range(n): data[i][0], data[i][1], data[i][2], data[i][3] = [int(x) for x in sys.stdin.readline().split()] colors[i] = (data[i][0] % 2) * 2 + (data[i][1] % 2...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int main() { long long n, x1, y1, x2, y2; ; cin >> n; cout << "YES\n"; for (long long i = 0; i < n; i++) { cin >> x1 >> y1 >> x2 >> y2; if (x1 % 2 == 0 && y1 % 2 == 0) cout << "1\n"; if (x1 % 2 == 0 && y1 % 2 != 0) cout << "2\n"; if (x1 % 2 != 0 &&...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; public class TimofeyAndRectangles { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; long long MOD = 1e9 + 7; int main() { ios_base::sync_with_stdio(0); int n; cin >> n; int x1, y1, x2, y2; cout << "YES" << endl; ; for (int i = 0; i < n; ++i) { cin >> x1 >> y1 >> x2 >> y2; if (x1 > x2) { swap(x2, x1); swap(y2, y1); } ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf("%d", &(n)); printf("YES\n"); for (int i = 0; i < n; i++) { int x1, x2, y1, y2; scanf("%d%d", &(x1), &(y1)); scanf("%d%d", &(x2), &(y2)); x1 %= 2; y1 %= 2; if (x1 < 0) x1 += 2; if (y1 < 0) y1 += 2; printf("%d...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 500005; int n; int main() { scanf("%d", &n); puts("YES"); for (int i = 1; i <= n; i++) { int x1, y1, x2, y2; scanf("%d%d%d%d", &x1, &y1, &x2, &y2); int ans; if (x1 % 2 && y1 % 2) ans = 1; else if (x1 % 2) ans = 2; e...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
n = input() v = [None] * n for i in xrange(n): x1, y1, _, _ = map(int, raw_input().split()) v[i] = 2 * (y1 & 1) + (x1 & 1) + 1 print 'YES' print '\n'.join(map(str, v))
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
n = int(input()) print("YES") for i in range(n): x1, y1, x2, y2 = input().split() print((int(x1) % 2) * 2 + (int(y1) % 2) + 1)
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; const long double MAXN = 1e6 + 7, SZ = 3 * 1e8; const long double MODM = 1e9 + 7, INF = 1e18 + 1; const int N = 6 * 1e5 + 2; vector<pair<int, pair<int, int>>> mas; bool used[N]; int c[N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; mas....
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
n = input() print 'YES' for i in xrange(n): x1, y1, _, _ = map(int, raw_input().split()) print 2 * (y1 & 1) + (x1 & 1) + 1
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int x, y, a, b, n; void init() { scanf("%d", &n); puts("YES"); for (int i = 1; i <= n; i++) { scanf("%d%d%d%d", &x, &y, &a, &b); printf("%d\n", 2 * abs(x % 2) + abs(y % 2) + 1); } } int main() { init(); return 0; }
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch > '9' || ch < '0') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); } return x * f; } int main() { int n = ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int n; cin >> n; cout << "YES" << endl; for (long long int i = 0; i < n; i++) { long long int a, b, c, d; cin >> a >> b >> c >> d; long long int ans = 2 * (a % 2) + (b % 2); ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; const int sz = 1e6; int main() { int n, c[sz]; scanf("%d", &n); for (int i = 0; i < n; ++i) { int x1, y1, x2, y2; scanf("%d%d%d%d", &x1, &y1, &x2, &y2); x1 %= 2; if (x1 < 0) x1 += 2; y1 %= 2; if (y1 < 0) y1 += 2; c[i] = x1 + 2 * y1; } p...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; inline void read(int &X); inline void print(int X); const int Maxn = 5E5 + 5; const int Maxm = 20000005; int N; int main() { read(N); int x1, y1, x2, y2; puts("YES"); for (register int i = (1); i <= (N); i++) read(x1), read(y1), read(x2), read(y2), print...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; void Get_Val(int &Ret) { Ret = 0; char ch; while (ch = getchar(), ch > '9' || ch < '0') ; do { (Ret *= 10) += ch - '0'; } while (ch = getchar(), ch >= '0' && ch <= '9'); } int main() { int N, a, b, c, d; printf("YES\n"); Get_Val(N); while (N--) { ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:102400000,102400000") using namespace std; const int N = 5e5 + 10, INF = 0x3f3f3f3f, MOD = 1e9 + 7; int n; int bx[N], by[N], ux[N], uy[N]; vector<int> G[N]; struct Line { int x, y, id; Line() {} Line(int x, int y, int id) : x(x), y(y), id(id) {} bool oper...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
n = int(input()) coordinates = [] for i in range(n): coordinates.append([int(x) % 2 for x in input().split()]) print('YES') for coordinate in coordinates: x1, y1, x2, y2 = coordinate print(2*x2 + y2 + 1)
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int c[2][2]; void init() { c[0][0] = 1; c[0][1] = 2; c[1][0] = 3; c[1][1] = 4; } int x[500500], y[500500]; int main() { int n; init(); scanf("%d", &n); int y1, y2, x1, x2; printf("YES\n"); for (int i = 0; i < int(n); i++) { scanf("%d %d %d %d", &x1, ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
from sys import stdin,stdout n = int(stdin.readline()) a = [0 for i in range(n)] for i in range(n): inp = stdin.readline().split() x = int(inp[0]) y = int(inp[1]) a[i] = 2 * (x % 2) + (y % 2) + 1 stdout.write("YES") stdout.write('\n') stdout.write("\n".join(str(i) for i in a))
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; const int dx[9] = {0, 1, -1, 0, 0, -1, -1, 1, 1}; const int dy[9] = {0, 0, 0, -1, 1, -1, 1, -1, 1}; const double pi = acos(-1.0); const int N = 110; int n; int main() { puts("YES"); scanf("%d", &n); for (int i = 1; i <= n; i++) { int x0, y0, x1, y1; scanf("%d"...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; const int N = 5e5; struct rect { int x1, y1, x2, y2; rect(int x1 = 0, int y1 = 0, int x2 = 0, int y2 = 0) : x1(x1), y1(y1), x2(x2), y2(y2) {} } r[N]; int col[N]; map<int, vector<int> > rx, ry; int n; int main(int argc, char* argv[]) { ios::sync_with_stdio(0); ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int main() { long n; cin >> n; cout << "YES" << endl; while (n--) { long long a, b, c, d; cin >> a >> b >> c >> d; a = a % 2; b = b % 2; if (a && b) cout << 1; else if (a && !b) cout << 2; else if (!a && b) cout << 3; ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const double eps = 1E-6; int main() { int x, y, a, b, n; while (cin >> n) { cout << "YES" << endl; for (int i = 0; i < n; i++) { cin >> x >> y >> a >> b; cout << (((x & 1) << 1) | (y & 1)) + 1 << ' '; } cout << end...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int main() { int n, v, vv, j, jj, x, y; cin >> n; cout << "YES\n"; for (int i = 0; i < n; i++) { cin >> v >> vv >> j >> jj; x = min(v, j); y = min(vv, jj); x = abs(x); y = abs(y); if (x % 2 == 0 && y % 2 == 0) { cout << 1 << endl; }...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; using namespace std; const double pi = acos(-1.0); int n; int x[2], y[2]; int color() { return (min(x[0], x[1]) % 2 + 2) % 2 * 2 + (min(y[0], y[1]) % 2 + 2) % 2 + 1; } int main() { cout << "YES\n"; cin >> n; for (long long(i) = (0); (i) < (n); ++(i)) { for (long...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; int n; int main() { scanf("%d", &n); int x, y, xx, yy; printf("YES\n"); for (int i = 0; i < n; i++) { scanf("%d%d%d%d", &x, &y, &xx, &yy); if (x % 2 == 0 && y % 2 == 0) printf("1\n"); else if (x % 2 == 0 && y % 2 != 0) ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> int n, a, b, c, d, e[2][2] = {1, 2, 3, 4}; int main() { scanf("%d", &n); puts("YES"); while (n--) { scanf("%d%d%d%d", &a, &b, &c, &d); printf("%d\n", e[a & 1][b & 1]); } return 0; }
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, x1, y1, x2, y2, i; cin >> n; cout << "YES\n"; for (i = 0; i < n; ++i) { cin >> x1 >> y1 >> x2 >> y2; if (x1 & 1 && y1 & 1) cout << "1"; else if (!(x1 & 1) && y1 & 1) ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using ll = long long; using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); int n; cin >> n; int x1, y1, x2, y2; vector<int> ans(n); for (ll i = 0, iLen = (n); i < iLen; ++i) { cin >> x1 >> y1 >> x2 >> y2; ans...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.HashMap; import java.util.StringTokenizer; /** * */ public class TaskD { public s...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; int main() { cout << "YES\n"; int n; cin >> n; for (int i = 0; i < n; ++i) { int x1, y1, x2, y2; x1 = max(x1, x2); y1 = max(y1, y2); scanf("%d %d %d %d", &x1, &y1, &x2, &y2); int c = 2 * (((x1 % 2) + 2) % 2) + (((y1 % 2) ...
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
#include <bits/stdc++.h> using namespace std; int main() { int n, x1, x2, y1, y2; cin >> n; cout << "YES\n"; while (n--) { cin >> x1 >> y1 >> x2 >> y2; cout << ((x1 & 1) * 2 + (y1 & 1) + 1) << endl; } return 0; }
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
import sys def rl(): return sys.stdin.readline() def ni(): return int(rl()) def nsa(): return rl().split() def nia(): return [int(x) for x in nsa()] def nnia(n): return [nia() for _ in range(n)] n = ni() rects = nnia(n) print('YES') for r in rects: print((r[0]%2)*2+(r[1]%2)+1)
Problem: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other. Help Timofey to color his rectangles in 4 ...
n = int(raw_input()) print "YES" for cnt in xrange(n): x1, y1, x2, y2 = raw_input().split() x1 = int(x1) y1 = int(y1) print 2*(x1 % 2) + (y1 % 2) + 1