Submission #5913108
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(); int[] c = new int[n]; for (int i = 0; i < n; i++) { c[i] = file.nextInt(); if (i % 2 == 0) a.add(c[i]); else b.add(c[i]); } if (a.size() == 1 && b.size() == 1) { if (c[0] == c[1]) { System.out.println(n / 2); } else { System.out.println(0); } } else { 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 | 2620 Byte |
Status | WA |
Exec Time | 236 ms |
Memory | 44092 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||
Status |
|
|
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 | 212 ms | 38324 KB |
ababa_1.txt | AC | 210 ms | 36232 KB |
eq_0.txt | WA | 184 ms | 35084 KB |
eq_1.txt | WA | 176 ms | 33164 KB |
rnd_17.txt | WA | 172 ms | 32284 KB |
sample1_3132.txt | AC | 70 ms | 17876 KB |
sample2_iw.txt | AC | 70 ms | 18516 KB |
sample3_1111.txt | AC | 71 ms | 18644 KB |
top2_0.txt | WA | 190 ms | 33208 KB |
top2_1.txt | WA | 193 ms | 35860 KB |
top2_2.txt | WA | 202 ms | 35852 KB |
top2_3.txt | WA | 200 ms | 37636 KB |
top2modoki_0.txt | WA | 186 ms | 37024 KB |
top2modoki_1.txt | WA | 190 ms | 32736 KB |
top2modoki_2.txt | WA | 188 ms | 35348 KB |
top2modoki_3.txt | WA | 193 ms | 33688 KB |
vary_1.txt | AC | 220 ms | 42780 KB |
vary_2.txt | AC | 236 ms | 44092 KB |
vary_3.txt | WA | 218 ms | 43852 KB |
zoro_0.txt | AC | 71 ms | 16340 KB |