Submission #2345840
Source Code Expand
#include "bits/stdc++.h" #define in std::cin #define out std::cout #define rep(i,N) for(int i=0;i<N;++i) typedef long long int LL; const LL mod = 1000000007; LL N, couA, couB, ans; std::vector<std::pair<LL, LL>>p; int main() { in >> N; std::vector<LL>a(N), b(N); rep(i, N) in >> a[i]; rep(i, N) in >> b[i]; rep(i, N) { p.push_back(std::make_pair(a[i], 1)); p.push_back(std::make_pair(b[i], 2)); } std::sort(p.begin(), p.end()); ans = 1; rep(i, 2 * N) { if (p[i].second == 1) ++couA; else ++couB; if (couA > 0 && couB > 0) { ans *= couA * couB; ans %= mod; --couA; --couB; } } out << ans << std::endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | Bwambocos |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 689 Byte |
Status | AC |
Exec Time | 99 ms |
Memory | 8048 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 | 3316 KB |
001.txt | AC | 22 ms | 1784 KB |
002.txt | AC | 31 ms | 1912 KB |
003.txt | AC | 34 ms | 2932 KB |
004.txt | AC | 89 ms | 7664 KB |
005.txt | AC | 98 ms | 7536 KB |
006.txt | AC | 99 ms | 7920 KB |
007.txt | AC | 98 ms | 7664 KB |
008.txt | AC | 98 ms | 6384 KB |
009.txt | AC | 98 ms | 7024 KB |
010.txt | AC | 98 ms | 8048 KB |
011.txt | AC | 98 ms | 6384 KB |
example0.txt | AC | 1 ms | 256 KB |
example1.txt | AC | 1 ms | 256 KB |