Submission #1014066
Source Code Expand
//冷静に考えると, 実際に分割点を求める必要はない。 #include <iostream> #include <algorithm> #include <vector> #include <cmath> using namespace std; #define int long long typedef pair<int, int> P; int n; vector<P> pa; signed main() { int i, pos; cin >> n; for (i = 0; i < n; i++) { cin >> pos; pa.push_back(P(pos, -1)); } for (i = 0; i < n; i++) { cin >> pos; pa.push_back(P(pos, 1)); } sort(pa.begin(), pa.end()); int diff = 0; int ans = 1; for (i = 0; i < pa.size(); i++) { ans *= max(abs(diff), 1LL); ans %= 1000000007; diff += pa[i].second; } cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | startcpp |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 656 Byte |
Status | WA |
Exec Time | 157 ms |
Memory | 4464 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 | 92 ms | 2420 KB |
001.txt | WA | 36 ms | 1400 KB |
002.txt | WA | 47 ms | 1400 KB |
003.txt | WA | 55 ms | 2420 KB |
004.txt | WA | 139 ms | 4464 KB |
005.txt | WA | 155 ms | 4464 KB |
006.txt | WA | 130 ms | 4464 KB |
007.txt | WA | 155 ms | 4464 KB |
008.txt | WA | 156 ms | 4464 KB |
009.txt | WA | 157 ms | 4464 KB |
010.txt | WA | 156 ms | 4464 KB |
011.txt | AC | 119 ms | 4464 KB |
example0.txt | AC | 3 ms | 256 KB |
example1.txt | AC | 3 ms | 256 KB |