Submission #5913063


Source Code Expand

import java.util.*;
import java.io.*;
import java.text.*;
import java.math.*;
import static java.lang.Integer.*;
import static java.lang.Double.*;
import java.lang.Math.*;

public class Main {

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	public void run() throws Exception {
		FastIO file = new FastIO();
		TreeSet<Integer> a = new TreeSet<>();
		TreeSet<Integer> b = new TreeSet<>();
		int n = file.nextInt();
		for (int i = 0; i < n; i++) {
			int x = file.nextInt();
			if (n % 2 == 0) a.add(x);
			else b.add(x);
		}
		System.out.println(a.size() - 1 + b.size() - 1);
	}

	public static class FastIO {
		BufferedReader br;
		StringTokenizer st;

		public FastIO() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	public static long pow(long n, long p, long mod) {
		if (p == 0)
			return 1;
		if (p == 1)
			return n % mod;
		if (p % 2 == 0) {
			long temp = pow(n, p / 2, mod);
			return (temp * temp) % mod;
		} else {
			long temp = pow(n, p / 2, mod);
			temp = (temp * temp) % mod;
			return (temp * n) % mod;

		}
	}

	public static long pow(long n, long p) {
		if (p == 0)
			return 1;
		if (p == 1)
			return n;
		if (p % 2 == 0) {
			long temp = pow(n, p / 2);
			return (temp * temp);
		} else {
			long temp = pow(n, p / 2);
			temp = (temp * temp);
			return (temp * n);

		}
	}

	public static long gcd(long x, long y) {
		if (x == 0)
			return y;
		else
			return gcd(y % x, x);
	}

	public static boolean isPrime(int n) {
		if (n <= 1)
			return false;
		if (n <= 3)
			return true;

		if (n % 2 == 0 || n % 3 == 0)
			return false;

		for (int i = 5; i * i <= n; i = i + 6)
			if (n % i == 0 || n % (i + 2) == 0)
				return false;

		return true;
	}
}

Submission Info

Submission Time
Task C - /\/\/\/
User zekigurbuz
Language Java8 (OpenJDK 1.8.0)
Score 0
Code Size 2421 Byte
Status WA
Exec Time 246 ms
Memory 43752 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 2
WA × 1
AC × 5
WA × 15
Set Name Test Cases
Sample sample1_3132.txt, sample2_iw.txt, sample3_1111.txt
All ababa_0.txt, ababa_1.txt, eq_0.txt, eq_1.txt, rnd_17.txt, sample1_3132.txt, sample2_iw.txt, sample3_1111.txt, top2_0.txt, top2_1.txt, top2_2.txt, top2_3.txt, top2modoki_0.txt, top2modoki_1.txt, top2modoki_2.txt, top2modoki_3.txt, vary_1.txt, vary_2.txt, vary_3.txt, zoro_0.txt
Case Name Status Exec Time Memory
ababa_0.txt AC 194 ms 35780 KB
ababa_1.txt AC 203 ms 34256 KB
eq_0.txt WA 175 ms 32492 KB
eq_1.txt WA 177 ms 35052 KB
rnd_17.txt WA 173 ms 32148 KB
sample1_3132.txt AC 70 ms 19156 KB
sample2_iw.txt AC 70 ms 18132 KB
sample3_1111.txt WA 70 ms 19284 KB
top2_0.txt WA 192 ms 36816 KB
top2_1.txt WA 199 ms 35596 KB
top2_2.txt WA 195 ms 33668 KB
top2_3.txt WA 197 ms 32276 KB
top2modoki_0.txt WA 194 ms 33116 KB
top2modoki_1.txt WA 188 ms 32756 KB
top2modoki_2.txt WA 210 ms 33360 KB
top2modoki_3.txt WA 191 ms 33716 KB
vary_1.txt AC 246 ms 43752 KB
vary_2.txt WA 219 ms 36492 KB
vary_3.txt WA 204 ms 38168 KB
zoro_0.txt WA 82 ms 21076 KB