Submission #1712927
Source Code Expand
#include<bits/stdc++.h> using namespace std; const int mod = 1000*1000*1000+7; int N; vector<int> A, B; vector<int> fact; int main() { fact.resize(100010); fact[0] = 1; for(int i = 1; i < 100010; i++) { fact[i] = 1LL * fact[i - 1] * i % mod; } scanf("%d", &N); A.resize(N); B.resize(N); for(int i = 0; i < N; i++) { scanf("%d", &A[i]); } for(int i = 0; i < N; i++) { scanf("%d", &B[i]); } sort(A.begin(), A.end()); sort(B.begin(), B.end()); int ans = 1; for(int i = N - 1; i >= 0; i--) { int s = i + 1, e = N - 1; int p = i; while(s <= e) { int m = (s + e)>>1; if(A[m] <= B[i]) { p = m; s = m + 1; } else e = m - 1; } ans = 1LL * ans * fact[p - i + 1] % mod; } cout << ans; }
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | choikiwon |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 953 Byte |
Status | WA |
Exec Time | 40 ms |
Memory | 1408 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:17:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &N); ^ ./Main.cpp:23:27: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &A[i]); ^ ./Main.cpp:26:27: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &B[i]); ^
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 | 25 ms | 1152 KB |
001.txt | WA | 10 ms | 768 KB |
002.txt | WA | 13 ms | 896 KB |
003.txt | WA | 15 ms | 896 KB |
004.txt | WA | 35 ms | 1280 KB |
005.txt | WA | 40 ms | 1408 KB |
006.txt | WA | 39 ms | 1408 KB |
007.txt | WA | 40 ms | 1408 KB |
008.txt | WA | 39 ms | 1408 KB |
009.txt | WA | 40 ms | 1408 KB |
010.txt | WA | 39 ms | 1408 KB |
011.txt | AC | 39 ms | 1408 KB |
example0.txt | AC | 2 ms | 640 KB |
example1.txt | AC | 2 ms | 640 KB |