Submission #1811345


Source Code Expand

package AtCoder_Code_Final_2016;

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 990 Byte
Status RE
Exec Time 82 ms
Memory 23380 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
RE × 2
RE × 14
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 RE 82 ms 19924 KB
001.txt RE 75 ms 21204 KB
002.txt RE 75 ms 21076 KB
003.txt RE 74 ms 23380 KB
004.txt RE 74 ms 18644 KB
005.txt RE 75 ms 21332 KB
006.txt RE 73 ms 20308 KB
007.txt RE 75 ms 21460 KB
008.txt RE 74 ms 19540 KB
009.txt RE 77 ms 19540 KB
010.txt RE 75 ms 19540 KB
011.txt RE 73 ms 16212 KB
example0.txt RE 75 ms 18644 KB
example1.txt RE 75 ms 21460 KB