Lights SOLUTION September Circuits ’20
There are N lights, numbered from 1 to N. At first every one of them are turned off. We will think about M days. We speak to the condition of every day as a line of length N, whose character is 1 if the light on that day was turned on, and 0 in any case. Every the very first moment of the accompanying things will occur:
1 L R: All the lights numbered from L to R are flipped, i.e, lights are killed in the event that they were turned on and the other way around.
2 A B L R: For each light from L to R, rely on how long from everyday, this light was on (Let it be x). Print the number of lights (from L to R) are there which were turned on an all out odd number of days (i.e, ). Likewise, print the base id of light (from L to R), which was turned on a complete odd number of days (considering from Ath day to Bth day). Condition of lights doesn’t change in this kind of question.
3 : Considering conditions of the apparent multitude of days till now, which day had the lexicographically biggest state (if various, print the soonest day). Condition of lights doesn’t change in this kind of inquiry.
First line contains a solitary number (), the quantity of experiments.
The principal line of each test contains two numbers, () and (), where means the quantity of ligths and indicates the quantity of days.
Every one of the following lines begins with a number () which speaks to the sort of question. On the off chance that is , it will be trailed by two numbers and (). In the event that is , it will be trailed by four numbers , and (, ), where X is the current day number. On the off chance that is , it will be the main whole number in that line.
For all the inquiries that are of type and type , print the necessary answer. In second sort of inquiry if no light among L and R was turned on a complete odd number of days (between Ath day and Bth day), print “0” (without cites). Likewise, in third sort of question, if there is no adjustment in the condition of lights (from 0th day), print “0” (without cites).
1 3 6
2 1 4
2 1 8
1 5 6
2 1 5 1 8
2 1 6 1 8
2 1 5
In the primary experiment of the given example:
State on 0th day: 00000000 (Initial State)
State on first day: 00111100
State on second day: 00111100 (stays same). On first day, among lights from 1 to 4, third and fourth lights (absolute 2 lights) were turned on an all out odd number (1) of days. Additionally, least id of light (which was turned on a complete odd number of days) is 3. So “2 3” ought to be printed.
State on third day: 00111100 (stays same). On first day, among lights from 1 to 8, third, fourth, fifth and sixth lights (absolute 4 lights) were turned on an all out odd number (1) of days. Additionally, least id of light is 3. So “4 3” ought to be printed.
State on fourth day: 00110000
State on fifth day: 00110000 (stays same). Thinking about initial 5 days, third and fourth lights were turned on 5 days. Likewise, fifth and sixth lights were turned on 3 days. In this way, third, fourth, fifth and sixth lights (complete 4 lights) were turned on an absolute odd number of days. Additionally, least id of light is 3. So “4 3” ought to be printed.
State on sixth day: 00110000 (stays same). Thinking about initial 6 days, third and fourth lights were turned on 6 days. fifth and sixth lights were turned on 3 days. In this way, fifth and sixth lights (complete 2 lights) were turned on an all out odd number of days. Likewise, least id of light is 5. So “2 5” ought to be printed.
State on seventh day: 00110000 (stays same). On first day, state was lexicographically biggest. So “1” ought to be printed.
In the subsequent experiment of the given example:
State on 0th day: 00000
State on first day: 00000 (stays same). Since no light from 1 to 5 was turned on an absolute odd number of days on first day, “0” ought to be printed.
State on second day: 00000 (stays same). Since there is no adjustment in state, “0” ought to be printed.
March Long Challenge 2021 Solutions
- An Interesting Sequence ISS SOLUTION
- Tree House THOUSES SOLUTION
- Valid Paths VPATH SOLUTION
- Modular Equation MODEQ SOLUTION
- Tic Tac Toe TCTCTOE SOLUTION
- Xor Equality XOREQUAL SOLUTION
- Golf LKDNGOLF SOLUTION
- Solubility SOLBLTY SOLUTION
April Long Challenge 2021 Solutions
- Chef and Dice SDICE Solution
- Worthy Matrix KAVGMAT Solution
- Binary String MEX MEXSTR Solution
- Boolean Game BOOLGAME Solution
- Tree Permutations TREEPERM Solution
- Destroy the EMP Chip CHAOSEMP Solution
- Chef and Pair Flips PAIRFLIP Solution
- String Power STRPOW Solution
- Brahma and Shiva SHRINES Solution
- Water Sort Puzzle (Challenge) WTRSORT Solution
- World Record BOLT Solution
- Strong Language SSCRIPT Solution
- Valid Pair SOCKS1 Solution
Codechef Long Challenge Solutions
February Long Challenge 2021
January Long Challenge 2021
- Chef and Division 3 DIVTHREE SOLUTION Code Chef
- Encoded String DECODEIT SOLUTION Code Chef
- Point Of Impact BILLRD SOLUTION Code Chef
- Fair Elections FAIRELCT SOLUTION Code Chef
- Watching CPL WIPL SOLUTION Code Chef
- Chef and Ants ANTSCHEF SOLUTION Code Chef
- Blackjack BLKJK SOLUTION Code Chef
- And-Or Game ORAND SOLUTION Code Chef
- Stack-Queue Sort (Challenge) SQSORT SOLUTION Code Chef
- Expected Number of SCCs RCTEXSCC SOLUTION Code Chef
- Curious Matrix CURMAT SOLUTION Code Chef
- Cool Subsets COOLSBST SOLUTION Code Chef
- Sequence Creation ARCRT SOLUTION Code Chef
- Greedy Students GRDSTD SOLUTION Code Chef
November Challenge 2020 SOLUTION CodeChef
- Ada and Dishes SOLUTION ADADISH
- Iron Magnet and Wall SOLUTION FEMA2
- Magical Candy Store SOLUTION CNDYGAME
- Unusual Queries SOLUTION UNSQUERS
- Red-Black Boolean Expression SOLUTION RB2CNF
- Chef and the Combination Lock SOLUTION CHEFSSM
- Scalar Product Tree SOLUTION SCALSUM
- Connect on a Grid (Challenge) SOLUTION CONGRID
October Lunchtime 2020 CodeChef SOLUTIONS
- AND Plus OR SOLUTION ANDOR
- Chef and Subtree MEXs SOLUTION SUBMEXS
- Chef Likes Good Sequences SOLUTION GSUB
- Cute Chef Gift SOLUTION COPAR
- Chef Is Just Throwing Random Words SOLUTION SSO
- Counting Spaghetti SOLUTION CDSUMS
- Chef and Edge Flipping SOLUTION EFLIP
- Top Best Keylogger in Python 3 Make One
- What is Hacking?
- Secrets of the Deep Dark Web
- CODECHEF September Lunchtime 2020 SOLUTIONS
- August Lunchtime 2020 SOLUTIONS
- A. Shandom Ruffle SOLUTION
- B. Pear TreaP SOLUTION
- C. Sneetches and Speeches 3 SOLUTION
- D. The Grim Treaper SOLUTION
- Y. Sneetches and Speeches 1 SOLUTION
- Z. Trick or Treap SOLUTION
- A. Floor Number SOLUTION CODE FORCES
- B. Symmetric Matrix SOLUTION CODE FORCES
- C. Increase and Copy SOLUTION CODE FORCES
- D. Non-zero Segments SOLUTION CODE FORCES
- E. Rock, Paper, Scissors SOLUTION CODE FORCES
- F. Number of Subsequences SOLUTION CODE FORCES
- Chef and Easy Queries SOLUTIONS CHEFEZQ
- Covid Run SOLUTIONS CVDRUN OCTOBER CHALLENGE
- Positive AND SOLUTIONS POSAND
- Replace for X SOLUTIONS REPLESX
- Village Road Network SOLUTIONS VILLNET
- Random Knapsack SOLUTIONS RANDKNAP
- D-Dimensional MST SOLUTIONS DDIMMST
- Compress all Subsegments SOLUTIONS SEGCOMPR
- Adding Squares SOLUTIONS ADDSQURE
- Inversions SOLUTIONS INVSMOD2 OCOTBER CHALLENGE
- Rooted Minimum Spanning Tree SOLUTIONS ROOTMST