Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.math.BigInteger;
- import java.util.*;
- public class EduA {
- public static void main(String []args){
- Scanner sc=new Scanner (System.in);
- int n=sc.nextInt();
- int k=sc.nextInt();
- int[]a= new int[k];
- boolean[]b= new boolean[600000+1];
- int []index= new int[n+1];
- for(int i=0;i<k;i++){
- a[i]=sc.nextInt();
- b[a[i]]=true;
- index[a[i]]=i;
- }
- for(int i=1;i<n/2 +1;i++){
- if(b[i]&&b[i*2])
- {
- if(index[i]>index[2*i])
- System.out.println((index[i*2]+1)+" "+(index[i]+1));
- else
- System.out.println((index[i]+1)+" "+(index[2*i]+1));
- return;
- }
- }
- System.out.println(0+" "+0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement