Submission #2852435
Source Code Expand
#include <iostream> #include <vector> #include <utility> #include <algorithm> #define llint long long #define mod 1000000007 using namespace std; llint n; vector< pair<llint, llint> > vec; int main(void) { cin >> n; llint a; for(int i = 0; i < n; i++){ cin >> a; vec.push_back(make_pair(a, 1)); } for(int i = 0; i < n; i++){ cin >> a; vec.push_back(make_pair(a, -1)); } sort(vec.begin(), vec.end()); llint ans = 1, stk = 0; for(int i = 0; i < vec.size(); i++){ if(vec[i].second > 0){ if(stk < 0){ ans *= -stk; } stk++; } else{ if(stk > 0){ ans *= stk; } stk--; } } cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | leaf1415 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 700 Byte |
Status | WA |
Exec Time | 98 ms |
Memory | 6256 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 | 59 ms | 2420 KB |
001.txt | WA | 22 ms | 1400 KB |
002.txt | WA | 30 ms | 1400 KB |
003.txt | WA | 34 ms | 2420 KB |
004.txt | WA | 87 ms | 4720 KB |
005.txt | WA | 97 ms | 5232 KB |
006.txt | WA | 97 ms | 4720 KB |
007.txt | WA | 98 ms | 6128 KB |
008.txt | WA | 97 ms | 5488 KB |
009.txt | WA | 96 ms | 5488 KB |
010.txt | WA | 96 ms | 5616 KB |
011.txt | AC | 96 ms | 6256 KB |
example0.txt | AC | 1 ms | 256 KB |
example1.txt | AC | 1 ms | 256 KB |