Submission #2702403
Source Code Expand
#include <bits/stdc++.h> #define rep(i,n) for(int i=0; i<(n); i++) #define reps(i,x,n) for(int i=x; i<(n); i++) #define rrep(i,n) for(int i=(n)-1; i>=0; i--) #define all(X) (X).begin(),(X).end() #define X first #define Y second #define pb push_back #define eb emplace_back using namespace std; typedef long long int ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; } template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); } const ll MOD = 1e9+7; int main(){ ios_base::sync_with_stdio(false); int N; int a[100005], b[100005]; vector<pii> v; cin >> N; rep(i,N) cin >> a[i], v.emplace_back(a[i], 1); rep(i,N) cin >> b[i], v.emplace_back(b[i], -1); sort(all(v)); ll ans = 1, cur = 0; for(auto p: v){ if( cur * p.Y < 0 ) ans = (ans * abs(cur)) % MOD; cur += p.Y; } cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | oyas |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 1094 Byte |
Status | AC |
Exec Time | 40 ms |
Memory | 2932 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 | 24 ms | 1780 KB |
001.txt | AC | 9 ms | 1020 KB |
002.txt | AC | 13 ms | 1144 KB |
003.txt | AC | 14 ms | 1656 KB |
004.txt | AC | 36 ms | 2932 KB |
005.txt | AC | 40 ms | 2932 KB |
006.txt | AC | 40 ms | 2932 KB |
007.txt | AC | 40 ms | 2932 KB |
008.txt | AC | 40 ms | 2932 KB |
009.txt | AC | 40 ms | 2932 KB |
010.txt | AC | 39 ms | 2932 KB |
011.txt | AC | 39 ms | 2932 KB |
example0.txt | AC | 1 ms | 256 KB |
example1.txt | AC | 1 ms | 256 KB |