Chefland Visa: VISA

Chefland Visa CodeChef Solution in C, C++, Java and Python

Public Submission link: Click here

CU Submission link: Click here

Ash is trying to get visa to Chefland. For the visa to be approved, he needs to satisfy the following three criteria:

  • Solve at least x1x1 problems on Codechef.
  • Have at least y1y1 current rating on Codechef.
  • Make his last submission at most z1z1 months ago.

You are given the number of problems solved by Chef (x2x2), his current rating (y2y2) and the information that he made his last submission z2z2 months ago. Determine whether he will get the visa.


  • The first line of the input contains a single integer TT denoting the number of test cases. The description of TT test cases follows.
  • The first and only line of each test case contains six space-separated integers x1x1, x2x2, y1y1, y2y2, z1z1 and z2z2.


For each test case, print a single line containing the string "YES" if Chef will get the visa or "NO" if he will not.

You may print each character of the string in uppercase or lowercase (for example, the strings “yEs”, “yes”, “Yes” and “YES” will all be treated as identical).


  • 1≤T≤5,0001≤T≤5,000
  • 20≤x1,x2≤5020≤x1,x2≤50
  • 1,900≤y1,y2≤2,1001,900≤y1,y2≤2,100
  • 1≤z1,z2≤61≤z1,z2≤6

Sample Input 1

20 50 2100 1900 6 6
50 20 1900 1900 5 5
20 20 1900 1900 1 6
27 27 1920 1920 3 3

Sample Output 1



Example case 1: Chef’s rating is less than the minimum required rating.

Example case 2: Chef has solved a smaller number of problems than the minimum required number.

Example case 3: Chef’s last submission was made before the allowed period.

Example case 4: All three conditions are met.

Chefland Visa CodeChef Solution in C

int main(void)
    int t;
    scanf("%d", &t);
        int x1,x2,y1,y2,z1,z2;
        scanf("%d %d %d %d %d %d", &x1,&x2,&y1,&y2,&z1,&z2);
        if(x2>=x1 && y2>=y1 && z2 <= z1)
	return 0;

Chefland Visa CodeChef Solution in C++ 17

int main()
    int t, x, x1, y, y1, z, z1; cin >> t;
        cin >> x >> x1 >> y >> y1 >> z >> z1;
        string ans = (x1 >= x && y1 >= y && z1 <= z) ? "YeS" : "No";
        cout << ans << endl;
    return 0;

Chefland Visa CodeChef Solution in Python 3

import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")
for _ in range(int(input())):
	print('YES' if x2>=x1 and y2>=y1 and z2 <= z1 else 'NO')

Chefland Visa CodeChef Solution in Java

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
	public static void main (String[] args) throws java.lang.Exception
		Scanner sc = new Scanner(;
		int T = sc.nextInt();
		while(T-- > 0)
		    int x1 = sc.nextInt();
		    int x2 = sc.nextInt();
		    int y1 = sc.nextInt();
		    int y2 = sc.nextInt();
		    int z1 = sc.nextInt();
		    int z2 = sc.nextInt();
		    System.out.println((x2 >= x1 && y2 >= y1 && z2 <= z1)?"YES":"NO");

 Chefland Visa CodeChef Solution
The content uploaded on this website is for reference purposes only. Please do it yourself first.