Submission #4307823
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; int kai[100010] = {0}; signed main(){ int n; cin >> n; kai[0] = kai[1] = 1; for(int i = 2;i <= n;i++){ kai[i] = i*kai[i-1]; kai[i] %= MOD; } 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 wa = 0; int cnt = 0; int ans = 1; for(auto x:s){ if(x.se == 1)wa++; if(x.se == 0){ wa--; cnt++; } if(wa == 0){ ans *= kai[cnt]; ans %= MOD; cnt = 0; } } 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 | 0 |
Code Size | 1328 Byte |
Status | WA |
Exec Time | 168 ms |
Memory | 13568 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 | 97 ms | 8320 KB |
001.txt | WA | 33 ms | 3200 KB |
002.txt | WA | 47 ms | 4352 KB |
003.txt | WA | 52 ms | 4736 KB |
004.txt | WA | 148 ms | 12032 KB |
005.txt | WA | 168 ms | 13568 KB |
006.txt | WA | 167 ms | 13568 KB |
007.txt | WA | 168 ms | 13568 KB |
008.txt | WA | 167 ms | 13568 KB |
009.txt | WA | 167 ms | 13568 KB |
010.txt | AC | 156 ms | 13568 KB |
011.txt | AC | 165 ms | 13568 KB |
example0.txt | AC | 1 ms | 256 KB |
example1.txt | AC | 1 ms | 256 KB |