Submission #1000886
Source Code Expand
#include<iostream> #include<vector> #include<algorithm> using namespace std; int a[100000],b[100000],n; vector<pair<int,int> > vec; int main(){ cin>>n; for(int i=0;i<n;i++){cin>>a[i];vec.push_back(make_pair(a[i],i));} for(int i=0;i<n;i++){cin>>b[i];vec.push_back(make_pair(b[i],i+n));} sort(vec.begin(),vec.end()); long long v=1;int cnt=0; for(int i=0;i<vec.size();i++){ if(vec[i].second<n){ if(cnt<0){v*=-cnt;} cnt++; } if(vec[i].second>=n){ if(cnt>0){v*=-cnt;} cnt--; } v%=1000000007; } cout<<v<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | E869120 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 573 Byte |
Status | WA |
Exec Time | 113 ms |
Memory | 2932 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | WA | 68 ms | 1780 KB |
001.txt | AC | 26 ms | 1020 KB |
002.txt | WA | 35 ms | 1144 KB |
003.txt | AC | 40 ms | 1656 KB |
004.txt | AC | 101 ms | 2932 KB |
005.txt | WA | 113 ms | 2932 KB |
006.txt | AC | 112 ms | 2932 KB |
007.txt | WA | 111 ms | 2932 KB |
008.txt | WA | 112 ms | 2932 KB |
009.txt | AC | 112 ms | 2932 KB |
010.txt | AC | 112 ms | 2932 KB |
011.txt | AC | 112 ms | 2932 KB |
example0.txt | AC | 3 ms | 256 KB |
example1.txt | AC | 2 ms | 256 KB |