Submission #2370491
Source Code Expand
// This file is a "Hello, world!" in C++ language by GCC for wandbox. #include <bits/stdc++.h> using namespace std; typedef long long ll; const ll MOD=1000000007; int main() { int n;cin>>n; vector<pair<int,int> > v; for(int i=0;i<n;i++){ int a;cin>>a; v.push_back(make_pair(a,0)); } for(int i=0;i<n;i++){ int b;cin>>b; v.push_back(make_pair(b,1)); } sort(v.begin(),v.end()); int ac=0;int bc=0;ll ans=1; for(int i=0;i<2*n;i++){ if(v[i].second){ bc++; }else{ ac++; } if(bc&&ac){ (ans*=ac*bc)%=MOD; ac--;bc--; } } cout<<ans<<endl; }
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | TAISA_ |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 728 Byte |
Status | AC |
Exec Time | 100 ms |
Memory | 2420 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 | 58 ms | 1400 KB |
001.txt | AC | 22 ms | 892 KB |
002.txt | AC | 30 ms | 892 KB |
003.txt | AC | 34 ms | 1400 KB |
004.txt | AC | 89 ms | 2420 KB |
005.txt | AC | 100 ms | 2420 KB |
006.txt | AC | 97 ms | 2420 KB |
007.txt | AC | 96 ms | 2420 KB |
008.txt | AC | 97 ms | 2420 KB |
009.txt | AC | 96 ms | 2420 KB |
010.txt | AC | 96 ms | 2420 KB |
011.txt | AC | 96 ms | 2420 KB |
example0.txt | AC | 1 ms | 256 KB |
example1.txt | AC | 1 ms | 256 KB |