Programming Geek
Rated 4.7/5 based on 1446 reviews

CodeVita 2017 Question: Chakravyuha

No comments :
Problem: Chakravyuha



During the battle of Mahabharat, when Arjuna was far away in the battlefield, Guru Drona made a Chakravyuha formation of the Kaurava army to capture Yudhisthir Maharaj. Abhimanyu, young son of Arjuna was the only one amongst the remaining Pandava army who knew how to crack the Chakravyuha. He took it upon himself to take the battle to the enemies.

Abhimanyu knew how to get power points when cracking the Chakravyuha. So great was his prowess that rest of the Pandava army could not keep pace with his advances. Worried at the rest of the army falling behind, Yudhisthir Maharaj needs your help to track of Abhimanyu's advances. Write a program that tracks how many power points Abhimanyu has collected and also uncover his trail 

A Chakravyuha is a wheel-like formation. Pictorially it is depicted as below 



A Chakravyuha has a very well-defined co-ordinate system. Each point on the co-ordinate system is manned by a certain unit of the army. The Commander-In-Chief is always located at the center of the army to better co-ordinate his forces. The only way to crack the Chakravyuha is to defeat the units in sequential order.

A Sequential order of units differs structurally based on the radius of the Chakra. The radius can be thought of as length or breadth of the matrix depicted above. The structure i.e. placement of units in sequential order is as shown below



The entry point of the Chakravyuha is always at the (0,0) co-ordinate of the matrix above. This is where the 1st army unit guards. From (0,0) i.e. 1st unit Abhimanyu has to march towards the center at (2,2) where the 25th i.e. the last of the enemy army unit guards. Remember that he has to proceed by destroying the units in sequential fashion. After destroying the first unit, Abhimanyu gets a power point. Thereafter, he gets one after destroying army units which are multiples of 11. You should also be a in a position to tell Yudhisthir Maharaj the location at which Abhimanyu collected his power points.

Input Format: First line of input will be length as well as breadth of the army units, say N

Output Format: 


  • Print NxN matrix depicting the placement of army units, with unit numbers delimited by (\t) Tab character
  • Print Total power points collected
  • Print coordinates of power points collected in sequential fashion (one per line)
Constraints: 0 < N <=100



Sample Input and Output



SNo.InputOutput
1 2
1 2
4 3
Total Power points : 1
(0,0)
2 5
1 2 3 4 5
16 17 18 19 6
15 24 25 20 7
14 23 22 21 8
13 12 11 10 9
Total Power points : 3
(0,0)
(4,2)
(3,2)



Do share your questions at vikash@programminggeek.in

TCS CodeVita 2018

No comments :



Welcome to TCS CodVita Season VII

Introduction

TCS CodeVita Season Seven is here! TCS CodeVita 2018 (Season 7) is here and I couldn't be more excited. It has been a while since I participated in CodeVita. Last time I participated in 2013. Many of my friends qualified but my team couldn't even clear round 1. Now I am back to studying, legally I can participate. I hope to see better questions and great competition in this contest. I was not blogging regularly since past 1 and half year, but I am back now and hope to help people around. As per TCS, Season 6 witnessed over 200,000 students from 3000+ institutes & 60+ countries take on the challenge. In last season TCS changed the format from Team Participation to individual participation. This will continue in TCS CodeVita 2018 as well.

Purpose of the Contest

The main objective for the contest is to sharpen the contestants' programming skills through some real-life computing practices.  The contest will also
  • Help TCS Spot the bright students
  • Provide students an opportunity to showcase their programming talent and earn peer recognition and honour
  • Provide an opportunity to showcase offerings of TCS to the academic world
  • Provides a platform to students to practice and enhance their programming skills
  • Provide exciting career opportunities for students in TCS

Structure of the Contest

This season TCS is continuing with the Individual participation like the previous edition. There are multiple coding levels before the top finalist can progress into the Grand Finale. To participate in CodeVita, one needs to register on the TCS Campus commune Portal.
There will be 3 main rounds to the contest
  • Pre-Qualifier Round (Round 1) :- Will be conducted as two zonal rounds, a participant will be tagged to one of the two zonal rounds. Details are provided in the round description section.
  • Qualifier Round (Round 2) : - Will be conducted once the pre- qualifier rounds is completed globally. Top performers from all the zonal rounds will compete in the qualifier round. Details are provided in the round description section
  • Grand Finale : The top 30 to 40 students from the qualifier round will take part in the Grand Finale and the top 3 ranked students will win prizes amounting to USD 20,000. Details are provided in the round description section. 
  • MockVita : To help contestants warm up for the contest, practice round(s) will be open to participants who have registered for the contest.This helps you get almost-real-feel of the Contest before the Pre-Qualifier Round. Timeline for the same would be communicated subsequently.

Participant Registration

Welcome to Phase 1 of the contest. Click on the Register button below to register yourself for the contest and start the Team Formation Process.
Notes

Important Notes

Starts : 28th March, 2018, 04:30 UTC
Ends : 15th July, 2018, 18:30 UTC
Takes Place : Online

This phase is open now..

TCS CodeVita 2018: Particpant Registration

Eligibility:: Coders from institutes across India who are completing their academic course in 2019, 20, 21 and 22 alone are eligible for this contest. Registrations are invited from students in under graduate/ post graduate programs related to engineering/science background with any specialization.

TCS CodeVita 2018: Registration Guidelines

  • To register for the contest, one has to log on to Campus Commune portal.
  • Students who are already registered on campus commune can directly register for the CodeVita.
  • For new users, you will have to sign-up on campus commune and then proceed to register for CodeVita.
  • It is an individual contest.
  • Each registered participant will be receiving a unique secret code or link at a later stage to take part in the contest.
  • This code/link is of utmost importance to take part in the contest rounds and should not even be shared between team-mates The Secret code/link will also be a part of login credentials for the contest platform.

Any student who is not a bonafide student from institutions or universities in INDIA, registering for INDIA Phase Pre-Qualifier would be disqualified and would not be permitted to participate in the Global Phase Pre-Qualifier as well.

TCS CodeVita 2018: General Guidelines

  • The infrastructure / software(s) required for compiling code solutions shall be borne by the individual participant or the institution he/she represent. TCS will not be liable for any damage to the institute’s infrastructure which may be caused by participants from the institute during the contest.
  • Language compilers are open source applications that can be downloaded from the internet. Participants will need to submit the compiled solution to a problem only. For example, codes written in Java should be submitted in .java format
  • CodeVita platform supports coding in multiple programming languages. Language and supported compiler / interpreter versions will be updated shortly. Broadly the following programming languages will be supported in the contest - C,C++,C#, Java, JavaScript, Pearl, PHP Python, Ruby. Addition of other programming languages will be updated.
  • Coding Guidelines will be provided as separate document. It will include information on scoring and ranking of teams in different rounds, list of URLs from which compilers and IDEs can be downloaded and other coding related instructions

TCS CodeVita 2018: Pre Qualifier Round


Notes

Important Notes


Starts: 27th July, 2018, 04:30 UTC
Ends: 11th August, 2018, 04:30 UTC
Bounty: 1000 Points
Takes Place : Online
This phase is not open yet.

The Pre- Qualifier round will be 24 hours contest window and each participant is provided with 6 hours of time to solve the questions. Pre-Qualifier round is done in INDIA as well as Rest of the world separately. This season there will be two zonal rounds in INDIA for Pre-Qualifier.

Details of the zone and the schedule for each zone is as follows


Students can check the branch they are part of from their profile page on Campus Commune and take part in the applicable zonal round.

TCS CodeVita 2018 : Qualifier Round


Notes

Important Notes


Starts: 4th December, 2018, 04:30 UTC
Ends: 5th December, 2018, 04:30 UTC
Bounty: 2500 Points
Takes Place: Online
This phase is not open yet.

This season Qualifier Round (Round 2) would happen after the completion of all the Pre-Qualifier rounds across the world.
Top performers from the zonal rounds globally will move into this round.
Each participant will be provided with 6 hours of time to solve & complete this round
The date given here is tentative and the qualifier round is scheduled to be conducted in the first week of December

TCS CodeVita 2018: Grand Finale


Notes

Important Notes


Start : 25th February, 2019, 05:30 UTC
Ends: 25th February, 2019, 14:30 UTC
Bounty: 5000 Points
Takes Place: At the Venue
This phase is not open yet.

Will be held in one of the TCSL offices in India.
Top 3 contestant will be declared as winners of the contest.
Winners (Top 3 contestants) will receive a total cash prize of USD 20,000.
TCS will be extending internships and offers to top coders from the contest
The grand finale is tentatively scheduled to be conducted in the last week of February, 2019. (The date indicated is subject to change)










What you can do here

  • Discussion with peers!
  • Find important tips and tricks!
  • Quick quotes for your query!