for(int i=0;i<n;i++){
            x = sc.nextInt();
            y = sc.nextInt();
            map01.put(y,x);
        }

似乎是笔误,
map01.put(x,y)