public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int[] arr=new int[n];
for (int i = 0; i < n; i++) {
arr[i]=sc.nextInt();
}
int[] ans=new int[n];
//set记录已经遍历过的钥匙
Set<Integer> set=new HashSet<>();
int min=1;//代表第i个门
for (int i = 0; i < n; i++) {
if(arr[i]==min){
ans[min-1]=i+1;
min++;
}
while (set.contains(min)){
ans[min-1]=i+1;
min++;
}
set.add(arr[i]);
}
for (int i = 0; i < n; i++) {
System.out.print(ans[i]+" ");
}
}
}
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int Q=sc.nextInt();
int seed=sc.nextInt();
Map<Integer,Integer> map=new HashMap<>();
int jicha = 0;
for(int i=0;i<Q;i++){
int[] arr=method(Q,seed);
int op=arr[0];
int m=arr[1];
int x=arr[2];
seed=arr[3];
// System.out.print(i+" "+op+" "+m+" "+x);
// System.out.println();
if(op == 1){
if(map.containsKey(x)){
map.put(x,map.get(x)+1);
}
else map.put(x,1);
}
else if(op == 2){
if(map.containsKey(x)){
int count=map.get(x);
count-=m;
if(count>0){
map.put(x,count);
}
else map.put(x,0);
}
}
else{
jicha = jicha ^ ((i+1)*jisuan(map));
//System.out.println(jicha);
}
}
System.out.println(jicha);
}
public static int[] method(int Q,int seed){
seed = seed ^ (seed << 15);
seed = seed ^ (seed >> 5);
seed = seed ^ (seed << 1);
seed = seed % (1 << 15);
int op = (seed^ (seed << 7) ^ (seed >> 5)) % 3 + 1;
int m= (seed ^ (seed <<6) ^ (seed >> 10)) % Q +1;
int x= (seed ^ (seed << 5) ^ (seed << 9) ^ (seed >> 6)) % 10 + 1;
return new int[]{op,m,x,seed};
}
public static int jisuan(Map<Integer,Integer> map){
int min=Integer.MAX_VALUE;
int max=Integer.MIN_VALUE;
for(Map.Entry entry:map.entrySet()){
if((int)entry.getValue()>0){
min=Math.min(min,(int)entry.getKey());
max=Math.max(max,(int)entry.getKey());
}
}
//System.out.println(max-min);
return max-min;
}
#360笔试##360#