Submission #3377815
Source Code Expand
#include <iostream> #include <map> using namespace std; using ll = long long; const ll MOD = 1e9 + 7; int main() { int N; cin >> N; map<int, int> coo; for (int i = 0; i < N; ++i) { int a; cin >> a; coo[a] = 1; } for (int i = 0; i < N; ++i) { int b; cin >> b; coo[b] = -1; } ll ans = 1; ll cnt = 0; for (auto p : coo) { ll k = p.second; if (cnt * k < 0) { ans *= abs(cnt); ans %= MOD; } cnt += k; } cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | Tiramister |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 627 Byte |
Status | AC |
Exec Time | 163 ms |
Memory | 9600 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 | 95 ms | 5888 KB |
001.txt | AC | 32 ms | 2304 KB |
002.txt | AC | 45 ms | 3072 KB |
003.txt | AC | 51 ms | 3456 KB |
004.txt | AC | 144 ms | 8576 KB |
005.txt | AC | 163 ms | 9600 KB |
006.txt | AC | 162 ms | 9600 KB |
007.txt | AC | 163 ms | 9600 KB |
008.txt | AC | 163 ms | 9600 KB |
009.txt | AC | 163 ms | 9600 KB |
010.txt | AC | 153 ms | 9600 KB |
011.txt | AC | 160 ms | 9600 KB |
example0.txt | AC | 1 ms | 256 KB |
example1.txt | AC | 1 ms | 256 KB |