Submission #1000574
Source Code Expand
#include <bits/stdc++.h> #define MOD 1000000007 using namespace std; typedef long long LL; int main(){ int n; cin >> n; pair<int,int> s[2*n]; for(int i = 0; i < n; i++){ cin >> s[i].first; s[i].second = -1; } for(int i = 0; i < n; i++){ cin >> s[i+n].first; s[i+n].second = 1; } sort(s,s+2*n); LL ans = 1; LL cur = 0; for(int i = 0; i < 2*n; i++){ if(abs(cur+s[i].second) < abs(cur)){ ans *= cur; ans %= MOD; } cur += s[i].second; } cout << ans << endl; }
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | ksun48 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 523 Byte |
Status | WA |
Exec Time | 114 ms |
Memory | 1792 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 | 66 ms | 1152 KB |
001.txt | AC | 26 ms | 640 KB |
002.txt | WA | 34 ms | 896 KB |
003.txt | AC | 38 ms | 768 KB |
004.txt | AC | 96 ms | 1664 KB |
005.txt | WA | 113 ms | 1792 KB |
006.txt | AC | 107 ms | 1792 KB |
007.txt | WA | 107 ms | 1792 KB |
008.txt | WA | 107 ms | 1792 KB |
009.txt | AC | 114 ms | 1792 KB |
010.txt | AC | 107 ms | 1792 KB |
011.txt | AC | 107 ms | 1792 KB |
example0.txt | AC | 3 ms | 256 KB |
example1.txt | AC | 3 ms | 256 KB |