You are not logged in. Please login at www.codechef.com to post your questions!

×

CHEGLOVE - Editorial

PROBLEM LINK:

Div1, Div2
Practice

Author: Praveen Dhinwa
Tester: Triveni Mahatha
Editorialist: Adarsh Kumar

DIFFICULTY:

Simple

PREREQUISITES:

None

PROBLEM:

You are given two array's $L$ and $G$ of $N$ integers. You need to check if $L[i] \le G[i]$ for all $1 \le i \le N$. You need to repeat this task after reversing $G$ too.

EXPLANATION:

This problem is really simple. You just need to implement whatever the problem states.

For chef to wear the glove in "front" position, check if $L[i] \le G[i]$ for all $1 \le i \le N$. This can be done using a linear traversal of both the array. Similarly, for chef to wear the glove in "back" position just reverse the array $G$ and check if $L[i] \le G[i]$ for all $1 \le i \le N$.

Now you just need to output "front", "back", "both", or "none" depending upon the conditions fulfilled.

Time Complexity:

$O(N)$

AUTHOR'S AND TESTER'S SOLUTIONS

Setter's solution
Tester's solution

This question is marked "community wiki".

asked 11 Mar, 17:56

adkroxx's gravatar image

7★adkroxx
306718
accept rate: 7%

edited 13 Mar, 15:29

admin's gravatar image

0★admin ♦♦
18.9k348495531

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×14,361
×995
×501
×264
×5

question asked: 11 Mar, 17:56

question was seen: 499 times

last updated: 13 Mar, 15:29