Submission #2823632
Source Code Expand
#include "bits/stdc++.h" #define ll long long #define rep2(i,a,b) for(int i=a;i<=b;++i) #define rep(i,n) for(int i=0;i<n;i++) #define pii pair<int,int> #define tii tuple<int,int,int> #define pq priority_queue<int> #define pqg priority_queue<int,vector<int>,greater<int>> #define pb push_back ll int MOD=1e9+7; #define INF 2*1e9 #define N 310000 using namespace std; string alphabet("abcdefghijklmnopqrstuvwxyz"); main(){ int n; cin>>n; vector<pii> v; rep(i,n){ int a;cin>>a; v.pb({a,0}); } rep(i,n){ int a;cin>>a; v.pb({a,1}); } sort(v.begin(),v.end()); int t=0,s; ll ans=1; rep(i,2*n){ s=v[i].second;t=1; while(t){ i++; if(v[i].second==s){ t++; } else{ ans=ans*t%MOD; t--; } } } cout<<ans; }
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | noimi |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 960 Byte |
Status | AC |
Exec Time | 99 ms |
Memory | 2420 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 | 1400 KB |
001.txt | AC | 22 ms | 892 KB |
002.txt | AC | 31 ms | 892 KB |
003.txt | AC | 34 ms | 1400 KB |
004.txt | AC | 88 ms | 2420 KB |
005.txt | AC | 99 ms | 2420 KB |
006.txt | AC | 98 ms | 2420 KB |
007.txt | AC | 98 ms | 2420 KB |
008.txt | AC | 98 ms | 2420 KB |
009.txt | AC | 98 ms | 2420 KB |
010.txt | AC | 98 ms | 2420 KB |
011.txt | AC | 97 ms | 2420 KB |
example0.txt | AC | 1 ms | 256 KB |
example1.txt | AC | 1 ms | 256 KB |