Submission #1998037
Source Code Expand
#include <bits/stdc++.h> #define int long long #define MOD 1000000007 using namespace std; typedef pair<int,int> P; signed main(){ vector<P> vec; int n,cnt = 0,ans = 1; cin >> n; for(int i = -1;i <= 1;i += 2){ for(int j = 0;j < n;j++){ int a; cin >> a; vec.push_back(P(a,i)); } } sort(vec.begin(),vec.end()); for(int i = 0;i < n * 2;i++){ if(cnt * vec[i].second < 0) ans = ans * abs(cnt) % MOD; cnt += vec[i].second; } cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | hoget157 |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 505 Byte |
Status | AC |
Exec Time | 98 ms |
Memory | 6384 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 | 2420 KB |
001.txt | AC | 22 ms | 1400 KB |
002.txt | AC | 30 ms | 1400 KB |
003.txt | AC | 34 ms | 2420 KB |
004.txt | AC | 87 ms | 5616 KB |
005.txt | AC | 98 ms | 4720 KB |
006.txt | AC | 98 ms | 6384 KB |
007.txt | AC | 98 ms | 6384 KB |
008.txt | AC | 98 ms | 5232 KB |
009.txt | AC | 98 ms | 5232 KB |
010.txt | AC | 97 ms | 4592 KB |
011.txt | AC | 97 ms | 4848 KB |
example0.txt | AC | 1 ms | 256 KB |
example1.txt | AC | 1 ms | 256 KB |