Submission #1811348


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 = 1L;
			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 947 Byte
Status WA
Exec Time 922 ms
Memory 98664 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 677 ms 63408 KB
001.txt WA 422 ms 45240 KB
002.txt WA 467 ms 48704 KB
003.txt WA 499 ms 56444 KB
004.txt WA 754 ms 77908 KB
005.txt WA 858 ms 88464 KB
006.txt WA 865 ms 95432 KB
007.txt WA 886 ms 96000 KB
008.txt WA 870 ms 95808 KB
009.txt WA 876 ms 95788 KB
010.txt WA 922 ms 97032 KB
011.txt AC 855 ms 98664 KB
example0.txt AC 94 ms 17104 KB
example1.txt AC 95 ms 22996 KB