Submission #2099551


Source Code Expand

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		long[] a = new long[n];
		long[] b = new long[n];
		long[] c = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = Long.parseLong(sc.next());
		for (int i = 0; i < n; i++)
			b[i] = Long.parseLong(sc.next());
		for (int i = 0; i < n; i++)
			c[i] = Long.parseLong(sc.next());
		Arrays.sort(a);
		Arrays.sort(b);
		Arrays.sort(c);
		long[] u = new long[n];
		int index = 0;
		for (int i = 0; i < n; i++) {
			while (index < n && a[index] < b[i])
				index++;
			if (i == 0)
				u[i] = index;
			else
				u[i] = u[i - 1] + index;
		}
		int[] l = new int[n];
		index = 0;
		for (int i = 0; i < n; i++) {
			while (index < n && b[index] < c[i])
				index++;
			l[i] = index;
		}
		int ans = 0;
		for (int i = 0; i < n; i++)
			if (l[i] != 0)
				ans += u[l[i] - 1];
		System.out.println(ans);

	}
}

Submission Info

Submission Time
Task C - Snuke Festival
User c_r_5
Language Java8 (OpenJDK 1.8.0)
Score 0
Code Size 1032 Byte
Status WA
Exec Time 679 ms
Memory 65784 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 16
WA × 16
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 WA 606 ms 59868 KB
02.txt WA 659 ms 64136 KB
03.txt WA 575 ms 62368 KB
04.txt WA 568 ms 61208 KB
05.txt WA 543 ms 63668 KB
06.txt WA 545 ms 63788 KB
07.txt WA 512 ms 63716 KB
08.txt WA 527 ms 61136 KB
09.txt WA 449 ms 61092 KB
10.txt WA 482 ms 60896 KB
11.txt AC 457 ms 61200 KB
12.txt AC 448 ms 60604 KB
13.txt WA 613 ms 61876 KB
14.txt AC 651 ms 61336 KB
15.txt AC 632 ms 61960 KB
16.txt AC 631 ms 65032 KB
17.txt AC 632 ms 63544 KB
18.txt AC 629 ms 60404 KB
19.txt WA 623 ms 63400 KB
20.txt WA 446 ms 62504 KB
21.txt AC 451 ms 65784 KB
22.txt AC 528 ms 62468 KB
23.txt WA 601 ms 63296 KB
24.txt WA 625 ms 61236 KB
25.txt WA 679 ms 61368 KB
26.txt AC 91 ms 21332 KB
27.txt AC 89 ms 18516 KB
28.txt AC 89 ms 20560 KB
29.txt AC 89 ms 19796 KB
s1.txt AC 92 ms 23252 KB
s2.txt AC 89 ms 18388 KB
s3.txt AC 89 ms 21460 KB