杀鸡牛刀:

import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        List<Integer> v = new ArrayList<>();
        while (sc.hasNext()) v.add(sc.nextInt());
        List<Integer> v1 = new ArrayList<>(v);
        List<Integer> v2 = new ArrayList<>(v);
        Collections.sort(v1, (a, b)->a - b);
        Collections.sort(v2, (a, b)->b - a);
        if(v.equals(v1) || v.equals(v2)) System.out.println("sorted");
        else System.out.println("unsorted");
    }
}