Print indices in non | C # program to implement the above approach ; Function to print the order of array elements generating non - decreasing quotient after division by X ; Stores the quotient and the order ; Traverse the array ; Sort the vector ; Print the order ; Driver Code
using System ; using System . Collections . Generic ; class GFG { static void printOrder ( int [ ] order , int N , int X ) { List < Tuple < int , int > > vect = new List < Tuple < int , int > > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( order [ i ] % X == 0 ) { vect . Add ( new Tuple < int , int > ( ( order [ i ] / X ) , i + 1 ) ) ; } else { vect . Add ( new Tuple < int , int > ( ( order [ i ] / X + 1 ) , i + 1 ) ) ; } } vect . Sort ( ) ; for ( int i = 0 ; i < N ; i ++ ) { Console . Write ( vect [ i ] . Item2 + " ▁ " ) ; } Console . WriteLine ( ) ; } public static void Main ( ) { int N = 3 , X = 3 ; int [ ] order = { 2 , 7 , 4 } ; printOrder ( order , N , X ) ; } }