Submission #1986298


Source Code Expand

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		long mod = (long) 1e9 + 7;
		long[] frac = new long[N+1];
		frac[0] = 1;
		for(int i=1;i<=N;i++) frac[i] = (frac[i-1] * i) % mod;
		
		Array.Sort(A);
		Array.Sort(B);
		
		long ans = 1;
		int tot = 0;
		int sig = 0;
		
		for(int i=0;i<N;i++){
			int s0 = A[i] > B[i] ? 1 : -1;
			if(s0 == sig){
				tot++;
				continue;
			}
			ans *= frac[tot];
			ans %= mod;
			sig = s0;
			tot = 1;
		}
		
		ans *= frac[tot];
		ans %= mod;
		
		Console.WriteLine(ans);
		
		
	}
	
	class Pair{
		public int Val, Sig;
		public Pair(int val, int sig){
			Val = val; Sig = sig; 
		}
	}
	
	
	int N;
	int[] A,B;
	public Sol(){
		N = ri();
		A = new int[N];
		for(int i=0;i<N;i++) A[i] = ri();
		B = new int[N];
		for(int i=0;i<N;i++) B[i] = ri();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}

Submission Info

Submission Time
Task A - 1D Matching
User kuuso
Language C# (Mono 4.6.2.0)
Score 0
Code Size 1661 Byte
Status WA
Exec Time 141 ms
Memory 16600 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 93 ms 13916 KB
001.txt WA 45 ms 9200 KB
002.txt WA 56 ms 11360 KB
003.txt WA 61 ms 11488 KB
004.txt WA 127 ms 16476 KB
005.txt WA 141 ms 14552 KB
006.txt WA 141 ms 16600 KB
007.txt WA 141 ms 16600 KB
008.txt WA 141 ms 16600 KB
009.txt WA 140 ms 16600 KB
010.txt AC 140 ms 16600 KB
011.txt WA 141 ms 14552 KB
example0.txt AC 21 ms 11092 KB
example1.txt AC 21 ms 11092 KB