Submission #1000581
Source Code Expand
#include <iostream> #include <fstream> #include <set> #include <map> #include <string> #include <vector> #include <bitset> #include <algorithm> #include <cstring> #include <cstdlib> #include <cmath> #include <cassert> #include <queue> #define mp make_pair #define pb push_back typedef long long ll; typedef long double ld; using namespace std; int n; vector<pair<int, int> > vv; const ll MOD = 1e9 + 7; int main() { scanf("%d", &n); for (int i = 0; i < n; ++i) { int x; scanf("%d", &x); vv.push_back(make_pair(x, 0)); } for (int i = 0; i < n; ++i) { int x; scanf("%d", &x); vv.push_back(make_pair(x, 1)); } sort(vv.begin(), vv.end()); int c = 0; ll ans = 1; for (int i = 0; i < (int)vv.size(); ++i) { if (vv[i].second == 0) { if (c < 0) ans = (ans * (-c)) % MOD; ++c; } else { if (c > 0) ans = (ans * c) % MOD; --c; } } cout << ans << "\n"; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | LHiC |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 976 Byte |
Status | AC |
Exec Time | 47 ms |
Memory | 2420 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:31:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &n); ^ ./Main.cpp:34:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &x); ^ ./Main.cpp:39:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &x); ^
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 | 29 ms | 1400 KB |
001.txt | AC | 12 ms | 892 KB |
002.txt | AC | 16 ms | 892 KB |
003.txt | AC | 18 ms | 1400 KB |
004.txt | AC | 42 ms | 2420 KB |
005.txt | AC | 47 ms | 2420 KB |
006.txt | AC | 47 ms | 2420 KB |
007.txt | AC | 47 ms | 2420 KB |
008.txt | AC | 47 ms | 2420 KB |
009.txt | AC | 47 ms | 2420 KB |
010.txt | AC | 46 ms | 2420 KB |
011.txt | AC | 47 ms | 2420 KB |
example0.txt | AC | 3 ms | 256 KB |
example1.txt | AC | 3 ms | 256 KB |