Submission #1000917
Source Code Expand
#include<iostream> #include<vector> #include<algorithm> using namespace std; long long a[300000],b[300000],n; vector<pair<long long,long long> > 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;long long cnt=0; for(int i=0;i<vec.size();i++){ if(vec[i].second<n){ if(cnt<0){v*=1LL*-cnt;} cnt++; } if(vec[i].second>=n){ if(cnt>0){v*=1LL*-cnt;} cnt--; } v%=1000000007LL; } 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 | 607 Byte |
Status | WA |
Exec Time | 161 ms |
Memory | 5488 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 | 91 ms | 3184 KB |
001.txt | AC | 31 ms | 1656 KB |
002.txt | WA | 49 ms | 1908 KB |
003.txt | AC | 56 ms | 2932 KB |
004.txt | AC | 137 ms | 5488 KB |
005.txt | WA | 155 ms | 5488 KB |
006.txt | AC | 157 ms | 5488 KB |
007.txt | WA | 158 ms | 5488 KB |
008.txt | WA | 161 ms | 5488 KB |
009.txt | AC | 158 ms | 5488 KB |
010.txt | AC | 160 ms | 5488 KB |
011.txt | AC | 158 ms | 5488 KB |
example0.txt | AC | 3 ms | 256 KB |
example1.txt | AC | 3 ms | 256 KB |