Submission #4307782
Source Code Expand
#include "bits/stdc++.h" typedef long long ll; #define int ll #define fi first #define se second #define SORT(a) sort(a.begin(),a.end()) #define rep(i,n) for(int i = 0;i < (n) ; i++) #define REP(i,n) for(int i = 0;i < (n) ; i++) #define MP(a,b) make_pair(a,b) #define pb(a) push_back(a) #define INF LLONG_MAX/2 using namespace std; int MOD = 1000000007; signed main(){ int n; cin >> n; map<int,int> m; m[0]; m[1]; set<pair<int,int>> s; rep(i,n){ int a; cin >> a; s.insert(MP(a,0)); } rep(i,n){ int a; cin >> a; s.insert(MP(a,1)); } int ans = 1; for(auto x:s){ int p = x.se; int q = (x.se+1)%2; if(m[q] == 0)m[p]++; else{ ans *= m[q]; ans %= MOD; m[q]--; } } cout << ans << endl; return 0; } // g++ -std=c++14 code1.cpp // rm -r -f test;oj dl https://ddcc2019-final.contest.atcoder.jp/tasks/ddcc2019_final_a // rm -r -f test;oj dl http://cf16-exhibition-final-open.contest.atcoder.jp/tasks/cf16_exhibition_final_a
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | Shibungi |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 1163 Byte |
Status | AC |
Exec Time | 202 ms |
Memory | 12800 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 | 100 ms | 7808 KB |
001.txt | AC | 33 ms | 2944 KB |
002.txt | AC | 47 ms | 4096 KB |
003.txt | AC | 53 ms | 4480 KB |
004.txt | AC | 157 ms | 11392 KB |
005.txt | AC | 202 ms | 12800 KB |
006.txt | AC | 187 ms | 12800 KB |
007.txt | AC | 195 ms | 12800 KB |
008.txt | AC | 183 ms | 12800 KB |
009.txt | AC | 177 ms | 12800 KB |
010.txt | AC | 168 ms | 12800 KB |
011.txt | AC | 178 ms | 12800 KB |
example0.txt | AC | 1 ms | 256 KB |
example1.txt | AC | 1 ms | 256 KB |