Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.util.Map;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.TreeMap;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Hamed Valizadeh (havaliza@gmail.com)
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastInputReader in = new FastInputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskB {
    int n, a, b;
    Map<Integer, Integer> position;
    int[] p;
    int[] group;

    public void solve(int testNumber, FastInputReader in, PrintWriter out) {
        n = in.nextInt();
        a = in.nextInt();
        b = in.nextInt();

        position = new TreeMap<Integer, Integer>();
        p = new int[n];
        group = new int[n];

        for (int i = 0; i < n; i++) {
            p[i] = in.nextInt();
            group[i] = -1;
            position.put(p[i], i);
        }

        for (int i = 0; i < n; i++) {
            if (getMate(i) != -1)
                continue;
            out.println("NO");
            return;
        }

        for (int i = 0; i < n; i++) {
            boolean aMate = position.containsKey(a - p[i]);
            boolean bMate = position.containsKey(b - p[i]);
            if (aMate && bMate)
                continue;
            if (group[i] != -1)
                continue;
            if (!solve(i)) {
                out.println("NO");
                return;
            }
        }

        for (int i = 0; i < n; i++) {
            if (group[i] != -1)
                continue;
            if (!solve(i)) {
                out.println("NO");
                return;
            }
        }

       ... Complexity: