Submission #4572560


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll N,ans=1,a,MOD=1e9+7,i;
	cin >> N;
	priority_queue<pair<ll,ll>> Q;
	for(i=0;i<N;i++)cin>>a,Q.push({-a,-1});
	for(i=0;i<N;i++)cin>>a,Q.push({-a,1});
	a = 0;
	while(!Q.empty()){
		i=Q.top().second;
		if(a!=i*llabs(a))
			(ans*=llabs(a))%=MOD;
		a+=i;Q.pop();
	}
	cout << ans << endl;
}

Submission Info

Submission Time
Task A - 1D Matching
User kenta2997
Language C++14 (GCC 5.4.1)
Score 500
Code Size 383 Byte
Status AC
Exec Time 111 ms
Memory 6256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 2
AC × 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 AC 67 ms 2420 KB
001.txt AC 25 ms 1400 KB
002.txt AC 34 ms 1400 KB
003.txt AC 38 ms 2420 KB
004.txt AC 100 ms 6128 KB
005.txt AC 111 ms 4592 KB
006.txt AC 111 ms 6256 KB
007.txt AC 111 ms 5104 KB
008.txt AC 111 ms 5744 KB
009.txt AC 111 ms 4976 KB
010.txt AC 110 ms 5616 KB
011.txt AC 111 ms 5488 KB
example0.txt AC 1 ms 256 KB
example1.txt AC 1 ms 256 KB