Help me in solving TLG problem

My issue

By seeing all the solution and statement i feel it should be solved by using arrays but in many solutions people have used normal input output method

My code

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	return 0;
}

Problem Link: TLG Problem - CodeChef

@eden66
Yess this question can be done in both ways.