Submission #2530794
Source Code Expand
import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.NoSuchElementException; public class Main { public static void main(String[] args) { FastScanner sc = new FastScanner(); int n = sc.nextInt(); int[] a = new int[n]; int[] b = new int[n]; int[] c = new int[n]; for(int i = 0; i < n; i++) { a[i] = sc.nextInt(); } for(int i = 0; i < n; i++) { b[i] = sc.nextInt(); } for(int i = 0; i < n; i++) { c[i] = sc.nextInt(); } Arrays.sort(a); Arrays.sort(b); Arrays.sort(c); int cnt = 0; int memo1 = 0; int memo2 = 0; for(int i = n-1; i >= 0; i--) { if(i != n-1 && a[i] == a[i+1]) { cnt += memo1; continue; } memo1 = 0; for(int j = n-1; j >= 0; j--) { if(a[i] >= b[j]) continue; if(j != n-1 && b[j] == b[j+1]) { cnt += memo2; memo1 += memo2; continue; } memo2 = 0; for(int k = n-1; k >= 0; k--) { if(b[j] < c[k]) { cnt++; memo1++; memo2++; } } } } System.out.println(cnt); } } class FastScanner { private final InputStream in = System.in; private final byte[] buffer = new byte[1024]; private int ptr = 0; private int buflen = 0; private boolean hasNextByte() { if (ptr < buflen) { return true; } else { ptr = 0; try { buflen = in.read(buffer); } catch (IOException e) { e.printStackTrace(); } if (buflen <= 0) { return false; } } return true; } private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1; } private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126; } private void skipUnprintable() { while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; } public boolean hasNext() { skipUnprintable(); return hasNextByte(); } public String next() { if (!hasNext()) throw new NoSuchElementException(); StringBuilder sb = new StringBuilder(); int b = readByte(); while (isPrintableChar(b)) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } public long nextLong() { if (!hasNext()) throw new NoSuchElementException(); long n = 0; boolean minus = false; int b = readByte(); if (b == '-') { minus = true; b = readByte(); } if (b < '0' || '9' < b) { throw new NumberFormatException(); } while (true) { if ('0' <= b && b <= '9') { n *= 10; n += b - '0'; } else if (b == -1 || !isPrintableChar(b)) { return minus ? -n : n; } else { throw new NumberFormatException(); } b = readByte(); } } public int nextInt() { long nl = nextLong(); if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException(); return (int) nl; } public double nextDouble() { return Double.parseDouble(next()); } }
Submission Info
Submission Time | |
---|---|
Task | C - Snuke Festival |
User | mochimochi |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 3002 Byte |
Status | WA |
Exec Time | 2109 ms |
Memory | 38192 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt, s3.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, s1.txt, s2.txt, s3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | TLE | 2105 ms | 36412 KB |
02.txt | TLE | 2108 ms | 23216 KB |
03.txt | TLE | 2109 ms | 30556 KB |
04.txt | TLE | 2105 ms | 22736 KB |
05.txt | TLE | 2109 ms | 22616 KB |
06.txt | TLE | 2108 ms | 24992 KB |
07.txt | WA | 653 ms | 25896 KB |
08.txt | WA | 1257 ms | 23224 KB |
09.txt | WA | 168 ms | 24276 KB |
10.txt | WA | 178 ms | 26752 KB |
11.txt | AC | 124 ms | 23220 KB |
12.txt | AC | 123 ms | 23412 KB |
13.txt | TLE | 2105 ms | 26556 KB |
14.txt | TLE | 2109 ms | 25528 KB |
15.txt | TLE | 2105 ms | 37052 KB |
16.txt | TLE | 2109 ms | 38192 KB |
17.txt | TLE | 2109 ms | 36072 KB |
18.txt | TLE | 2109 ms | 37264 KB |
19.txt | TLE | 2109 ms | 26356 KB |
20.txt | WA | 126 ms | 22964 KB |
21.txt | AC | 106 ms | 21760 KB |
22.txt | AC | 139 ms | 25264 KB |
23.txt | TLE | 2109 ms | 35848 KB |
24.txt | TLE | 2105 ms | 24844 KB |
25.txt | TLE | 2108 ms | 27772 KB |
26.txt | AC | 67 ms | 19156 KB |
27.txt | AC | 68 ms | 19156 KB |
28.txt | AC | 67 ms | 19284 KB |
29.txt | AC | 67 ms | 18900 KB |
s1.txt | AC | 67 ms | 19284 KB |
s2.txt | AC | 69 ms | 18900 KB |
s3.txt | AC | 68 ms | 19284 KB |