Submission #2591831
Source Code Expand
#include<bits/stdc++.h> using namespace std; using i64 = long long int; const i64 MOD = 1e9 + 7; i64 fact[100005] = {0}; void factorial(i64 n){ fact[1] = 1; for(int i=2;i<=n;++i)fact[i] = i * fact[i-1] % MOD; } int main(){ int n; cin >> n; vector<pair<i64, int>> v; for(int i=0;i<n;++i){ i64 a; cin >> a; v.emplace_back(a, 1); } for(int i=0;i<n;++i){ i64 b; cin >> b; v.emplace_back(b, -1); } sort(v.begin(), v.end()); i64 maxi = 0, acc = 0; for(auto e : v){ acc += e.second; maxi = max(maxi, abs(acc)); } factorial(maxi); cout << fact[maxi] << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | nicklaw296 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 744 Byte |
Status | WA |
Exec Time | 98 ms |
Memory | 6256 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 | 59 ms | 2420 KB |
001.txt | WA | 22 ms | 1400 KB |
002.txt | WA | 30 ms | 1400 KB |
003.txt | WA | 34 ms | 2420 KB |
004.txt | WA | 86 ms | 4464 KB |
005.txt | WA | 97 ms | 5872 KB |
006.txt | WA | 97 ms | 6256 KB |
007.txt | WA | 96 ms | 4720 KB |
008.txt | WA | 96 ms | 5232 KB |
009.txt | WA | 96 ms | 5360 KB |
010.txt | AC | 98 ms | 6256 KB |
011.txt | AC | 97 ms | 5616 KB |
example0.txt | AC | 1 ms | 256 KB |
example1.txt | AC | 1 ms | 256 KB |