import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner f=new Scanner(System.in);
int N=f.nextInt();
int M=f.nextInt();
int K=f.nextInt();
int []ar=new int[N];
int []hierarchy=new int[M];
for(int i=0; i<M; i++){
hierarchy[i]=f.nextInt();
}
for(int i=0; i<K; i++){
int num=f.nextInt();
int pos=f.nextInt()-1;
ar[pos]=num;
}
}
}
So i've essentailly established the numbers that have fixed positions in the array and need to find the earliest position 1 can be put whil also keeping in mind that 4 5 6 need to be in order(numbers can be between them). How would I do this?