You are viewing a single comment's thread. Return to all comments →
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int x=sc.nextInt(); for(int p=0;p<x;p++){ int N=sc.nextInt(); int Q=sc.nextInt(); int[] arr=new int[N]; int[][] arr1=new int[Q][3]; int y=0; for(int i=0;i<N;i++){ arr[i]=sc.nextInt(); } for(int j=0;j<Q;j++){ arr1[j][0]=sc.nextInt(); arr1[j][1]=sc.nextInt(); arr1[j][2]=sc.nextInt(); }for(int k=0;k<Q;k++){ int min=Integer.MIN_VALUE; for(int i=arr1[k][1];i<=arr1[k][2];i++){ y=arr[i-1]^arr1[k][0]; min=y>=min?y:min; }System.out.println(min); } }sc.close(); }}
facing time out from 2 to 10 need help 1,11,12,13 passed
Seems like cookies are disabled on this browser, please enable them to open this website
XOR key
You are viewing a single comment's thread. Return to all comments →
facing time out from 2 to 10 need help 1,11,12,13 passed