Submission #1811316


Source Code Expand

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

class event implements Comparable<event>{
		public int a;
		public int b;
		public event(int a , int b){
			this.a = a;
			this.b = b;
		}
		
		public int compareTo(event other){
			// return b - other.b;
			return Integer.compare(b , other.b);
		}
		
}

public class Main{


	
	public static void main(String[] args) {
			
			long mod = 10^9+7;
			
			Scanner in = new Scanner(System.in);
			int n = in.nextInt();
			int size[] = new int[2];
			event[] a = new event[2*n];
			
		    for (int x=0; x<2; x++)
		    	for (int i=0; i< n; i++)
		    		a[i+x*n] = new event(x, in.nextInt());
	
			Arrays.sort(a);
	
			long res = 1;
			for(event e : a){
				if(size[1 - e.a] > 0){
					res *= size[1 - e.a];
					//res %= mod;
					size[1 - e.a]--;
				}else{
					size[e.a]++;
				}
				
			}
			
			System.out.println(res);
			
			
		}

}

Submission Info

Submission Time
Task A - 1D Matching
User Younes
Language Java8 (OpenJDK 1.8.0)
Score 0
Code Size 942 Byte
Status WA
Exec Time 885 ms
Memory 95956 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 2
AC × 3
WA × 11
Set Name Test Cases
Sample example0.txt, example1.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, example0.txt, example1.txt
Case Name Status Exec Time Memory
000.txt WA 614 ms 64920 KB
001.txt WA 399 ms 42484 KB
002.txt WA 459 ms 47812 KB
003.txt WA 473 ms 54568 KB
004.txt WA 749 ms 73548 KB
005.txt WA 813 ms 94644 KB
006.txt WA 885 ms 95076 KB
007.txt WA 818 ms 95344 KB
008.txt WA 777 ms 90668 KB
009.txt WA 794 ms 66864 KB
010.txt WA 884 ms 95096 KB
011.txt AC 799 ms 95956 KB
example0.txt AC 93 ms 19796 KB
example1.txt AC 93 ms 21716 KB