Submission #2263462
Source Code Expand
#include<bits/stdc++.h> using namespace std; #define int long long #define rep(i,n) for(int i=0;i<(n);i++) #define pb push_back #define all(v) (v).begin(),(v).end() #define fi first #define se second typedef vector<int>vint; typedef pair<int,int>pint; typedef vector<pint>vpint; template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;} template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;} const int mod=1000000007; signed main(){ int N; cin>>N; vpint v; rep(i,N){ int a;cin>>a; v.pb({a,0}); } rep(i,N){ int a;cin>>a; v.pb({a,1}); } sort(all(v)); int s=0; int ans=1; rep(i,v.size()){ if(!v[i].se){ if(s<0)ans=ans*(-s)%mod; s++; } else{ if(s>0)ans=ans*s%mod; s--; } } cout<<ans<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | latte0119 |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 953 Byte |
Status | AC |
Exec Time | 102 ms |
Memory | 5232 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 500 / 500 | ||||
Status |
|
|
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 | 59 ms | 2420 KB |
001.txt | AC | 22 ms | 1400 KB |
002.txt | AC | 30 ms | 1400 KB |
003.txt | AC | 34 ms | 2420 KB |
004.txt | AC | 87 ms | 4976 KB |
005.txt | AC | 97 ms | 4848 KB |
006.txt | AC | 98 ms | 4464 KB |
007.txt | AC | 96 ms | 4720 KB |
008.txt | AC | 97 ms | 5104 KB |
009.txt | AC | 102 ms | 4592 KB |
010.txt | AC | 96 ms | 4976 KB |
011.txt | AC | 96 ms | 5232 KB |
example0.txt | AC | 1 ms | 256 KB |
example1.txt | AC | 1 ms | 256 KB |