Home » Compete » June Cook-Off 2021 Division 3
Scorable Problems for Division 3
Chefland Visa Problem Code: VISA
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 problems on Codechef.
- Have at least current rating on Codechef.
- Make his last submission at most months ago.
You are given the number of problems solved by Chef (), his current rating () and the information that he made his last submission months ago. Determine whether he will get the visa.
Input
- The first line of the input contains a single integer denoting the number of test cases. The description of test cases follows.
- The first and only line of each test case contains six space-separated integers , , , , and .
Output
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).
Constraints
Example Input
4
20 50 2100 1900 6 6
50 20 1900 1900 5 5
20 20 1900 1900 1 6
27 27 1920 1920 3 3
Example Output
NO
NO
NO
YES
Explanation
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.
Python :
for _ in range(int(input())):x1, x2, y1, y2, z1, z2 = map(int, input().split())if(x2>=x1 and y2>=y1 and z2<=z1):print("YES")else:print("NO")
C++ :
#include <iostream>using namespace std;int main() {int t;cin>>t;for (int i = 0; i < t; i++) {int x1,x2,y1,y2,z1,z2;cin>>x1>>x2>>y1>>y2>>z1>>z2;if((x1<=x2)&&(y1<=y2)&&(z1>=z2)){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}}return 0;}
ICPC Balloons Problem Code: BALLOON
Chef is participating in an ICPC regional contest, in which there is a total of problems (numbered through ) with varying difficulties. For each valid , the -th easiest problem is problem .
After a team solves a problem, a balloon with a colour representing that problem is tied next to their desk. Chef is fond of colours in VIBGYOR, which are representative of the problems with numbers through . The remaining problems have their own representative colours too.
Find the minimum number of problems which Chef's team needs to solve in order to get all the balloons for problems through (and possibly some other balloons too) tied next to their desk, if you know that Chef's team knows the difficulties of all problems and solves the problems in increasing order of difficulty.
Input
- The first line of the input contains a single integer denoting the number of test cases. The description of test cases follows.
- The first line of each test case contains a single integer .
- The second line contains space-separated integers .
Output
For each test case, print a single line containing one integer ― the minimum number of problems Chef's team needs to solve.
Constraints
- for each valid
- are pairwise distinct
Example Input
3
7
1 2 3 4 5 7 6
8
8 7 6 5 4 3 2 1
9
7 4 3 5 6 1 8 2 9
Example Output
7
8
8
Explanation
Example case 1: Since there are a total of problems, Chef's team will have to solve all of them.
Example case 2: Problems through appear among the first problems.
Example case 3: Problems through again appear among the first problems.
Python :
C++ :
The Wave Problem Code: WAV2
Chef is stuck in the wavey world of polynomials. You are given all roots of a polynomial . The roots are pairwise distinct integers, but they are not given in any particular order.
To help Chef escape, you should answer queries (numbered through ). For each valid , in the -th query, you are given an integer and you have to determine whether is positive, negative or .
Input
- The first line of the input contains two space-separated integers and .
- The second line contains space-separated integers .
- lines follow. For each valid , the -th of these lines contains a single integer describing the -th query.
Output
For each query, print a single line containing the string "POSITIVE"
, "NEGATIVE"
or "0"
(without quotes) describing the value of the polynomial for the -th query.
Constraints
- for each valid
- are pairwise distinct
- for each valid
Example Input
4 6
1 3 5 100
-2
2
4
80
107
5
Example Output
POSITIVE
NEGATIVE
POSITIVE
NEGATIVE
POSITIVE
0
Python :
import bisect N,Q=map(int,input().split()) arr=list(map(int,input().split())) arr.sort() for it in range(Q): e=int(input()) if e>arr[-1]: print("POSITIVE") continue if e<arr[0]: if N%2==0: print("POSITIVE") continue else: print("NEGATIVE") continue ba=bisect.bisect_left(arr,e) if ba+1!=N: if e == arr[ba+1]: print(0) continue if e==arr[ba]: print(0) continue if (N-ba)%2==1: print("NEGATIVE") continue else: print("POSITIVE") continue
Cpp :
#include<bits/stdc++.h>using namespace std;#define ll long long#define FAST1 ios_base::sync_with_stdio(false);#define FAST2 cin.tie(NULL); void solve(){ ll n,q; cin>>n>>q; ll arr[n]; for(ll i=0;i<n;i++) cin>>arr[i]; sort(arr,arr+n); for(ll i=0;i<q;i++){ ll x; cin>>x; ll pos=lower_bound(arr,arr+n,x)-arr; if(pos<n && arr[pos]==x) cout<<0<<endl; else if(pos%2==0) cout<<"POSITIVE"<<endl; else cout<<"NEGATIVE"<<endl; }} int main(){ FAST1; FAST2; ll t=1; //cin>>t; while(t--){ solve(); }}