Submission #3775654
Source Code Expand
#include <bits/stdc++.h> using namespace std; #define REP(i,m) for(int i=0; i<m; i++) #define FOR(i,n,m) for(int i=n; i<m; i++) #define INF 1000000007 #define INFL (1LL << 60) #define MOD 998244353 #define ALL(v) v.begin(),v.end() #define pb push_back #define ll long long int #define P pair<ll, ll> int main(){ ll ans = 1; ll fact[100010]; fact[0] = 1; REP(i, 100009) fact[i+1] = (fact[i] * (i+1))%INF; int n; cin >> n; P p[2*n]; REP(i, n){ int a; cin >> a; p[i] = {a, 0}; } REP(i, n){ int a; cin >> a; p[n+i] = {a, 1}; } sort(p, p+2*n); int ax = 0, bx = 0; REP(i, 2*n){ if(p[i].second == 0) ax++; else bx++; if(ax == bx){ ans = (ans * fact[ax]); ax = 0; bx = 0; } } cout << ans << endl; }
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | EctoPlasma |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 830 Byte |
Status | WA |
Exec Time | 124 ms |
Memory | 4096 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 | 74 ms | 2944 KB |
001.txt | WA | 28 ms | 1664 KB |
002.txt | WA | 38 ms | 1920 KB |
003.txt | WA | 43 ms | 2048 KB |
004.txt | WA | 110 ms | 3840 KB |
005.txt | WA | 124 ms | 4096 KB |
006.txt | WA | 122 ms | 4096 KB |
007.txt | WA | 124 ms | 4096 KB |
008.txt | WA | 122 ms | 4096 KB |
009.txt | WA | 124 ms | 4096 KB |
010.txt | AC | 121 ms | 4096 KB |
011.txt | AC | 123 ms | 4096 KB |
example0.txt | AC | 2 ms | 1024 KB |
example1.txt | AC | 2 ms | 1024 KB |